0

Is it enough and Hibernate checks methods automatically that are doing stuff with that entity and updates the cache? Or @Cacheable, @CachePut, @CacheEvict annotations above methods are mandatory for a working cache.

Abdur Rahman
  • 1,420
  • 1
  • 21
  • 32

1 Answers1

1

What is cached depends on the configuration. If you enable selective caching, you need to annotate all entities with @Cacheable that should be cached. For queries, you additionally need to provide a cache hint, but all of that can be read in the official documentation: https://docs.jboss.org/hibernate/orm/5.5/userguide/html_single/Hibernate_User_Guide.html#caching

Christian Beikov
  • 15,141
  • 2
  • 32
  • 58