How the hibernate API fetch the peristent object from cache second time ( 1st leve and 2 nd Level).
I know, first request fetched from database and give the peristent object and also put into 1st level cache( also 2nd level cache if enabled).
When qurey the second time how it will fetch from cache? How load() and get() will fetch?
Also, what is the role of equals(), hashcode() in the persitent pojo? Based on this euqls() it will fetch the persistent object from cache?
If equals() fails(implemented proper way) what will happen, means each and every time it will hit the database?