0

I am using non strict read write strategy.
I have a managed object that I have just persisted.
The session will be closed and I will need this object very soon. however, it won't be in the session cache anymore and I want to avoid hitting the DB for this object when I need it.
Therefore I want it to be in the second level cache (and still managed by hibernate).

madarinho
  • 87
  • 1
  • 1
  • 10
  • Without changing the strategy of course – madarinho Mar 23 '16 at 22:06
  • Also, specify what 2LC implementation you use and what is your ORM version. For example with Infinispan 2LC on Hibernate 5.1, the object gets safely into the cache even if you close the session very soon, and you will get the object in any new session. See http://docs.jboss.org/hibernate/orm/5.1/userguide/html_single/Hibernate_User_Guide.html#caching-provider-infinispan for details. – Radim Vansa Mar 24 '16 at 16:48

0 Answers0