来自 Hibernate 文档(重点是我的):
By default, entities are not part of the second level cache and we recommend you to stick to this setting. However, you can override this by setting the shared-cache-mode element in your persistence.xml file or by using the javax.persistence.sharedCache.mode property in your configuration.
二级缓存中缓存了什么?
最佳答案
你有一级缓存和二级缓存。 第一级缓存保留在事务上,这就是为什么您必须调用刷新才能在使用同一行的事务之间保持一致。 然而,二级缓存在事务之间共享。
缓存相同的对象,区别在于它们是否在 session 之间共享。
关于java - 二级缓存中缓存了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42113609/