java - Duplicate Object with same identifier Spring Data -


so here problem i'm using spring data handle persistent side of application, i've no error notice weird thing could't understand.

suppose have 2 queries different criteria , there object match 2 queries problem object returned first query , other returned second aren't referring same instance hence there separate instance same identifier.

but since same object should have 1 instance means when second query executed , result include object loaded first query should use instance not creating new one.

example :

first query : id = 21 object=com.bougsid.app.order.order@7aea8d88

second query: id = 21 object=com.bougsid.app.order.order@6eb0e570

so please me figure out way can go through , preventing create new instance of object loaded.