将@Cacheable 或@Cache 置于Entity 之上是否足以让Hibernate 开始缓存?

Is putting @Cacheable or @Cache above the Entity enough for Hibernate to start caching?

Hibernate 自动检查正在处理该实体的方法并更新缓存是否足够? 或者 @Cacheable@CachePut@CacheEvict 以上方法的注释对于工作缓存是强制性的。

缓存的内容取决于配置。如果启用选择性缓存,则需要用 @Cacheable 注释所有应缓存的实体。对于查询,您还需要提供缓存提示,但所有这些都可以在官方文档中阅读:https://docs.jboss.org/hibernate/orm/5.5/userguide/html_single/Hibernate_User_Guide.html#caching