What does CacheMode do ?
-
a) a) controls how a particular SessionFactory interacts with the Data Base.
-
b) controls how a particular SessionFactory interacts with the second-level cache.
-
c) controls how a particular session interacts with the second-level cache.
-
d) None
CacheMode controls how a particular Session interacts with the second-level cache. It determines whether the session should read from, write to, or interact with the second-level cache during operations like loading, saving, or updating entities.
In Hibernate, CacheMode is a setting configured on a Session (not the SessionFactory) that controls how that particular session interacts with the second-level cache — for example, whether it reads from, writes to, refreshes, or ignores the cache during that session's operations. It has nothing to do with direct database interaction (that's just normal ORM behavior) and is scoped to the session, not globally to the SessionFactory, which is why the SessionFactory-level options are incorrect.