0

In my code, same query with same parameters is getting executed twice in a loop during a short period of time using HibernateTemplate.find(). What is happening is, the address of the list returned by both the executions is the same. Why is Hibernate reusing an old object?

Satej Koli
  • 79
  • 2
  • 15
  • Reusing the old object is faster. – Peter G. Aug 24 '16 at 18:20
  • Possible duplicate of [What are First and Second Level caching in Hibernate?](http://stackoverflow.com/questions/337072/what-are-first-and-second-level-caching-in-hibernate) – Justinas Jakavonis Aug 25 '16 at 06:14
  • Hibernate caches previous results. Check http://stackoverflow.com/questions/39022586/do-jpa-hibernate-load-data-which-changes-asynchronously-in-db/39026509#39026509 for more details. – Justinas Jakavonis Aug 25 '16 at 06:15

0 Answers0