4

I've seen it written that the Hibernate second-level cache is only used when invoking the load method. I can't find any conclusive answers about whether it's used when calling get, which the GenericDAO project we've integrated with uses primarily.

Is the second-level cache used when calling org.hibernate.Session.get(Class clazz, Serializable id)?

DataNucleus
  • 15,497
  • 3
  • 32
  • 37
DeejUK
  • 12,891
  • 19
  • 89
  • 169

1 Answers1

9

Yes, of course it's used by get. Session.load generates a proxy to the entity, without even checking if the entity exists, so the second-level cache is much more relevant for get than for load.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255