show-sql: true
                  
                  
                      properties:
                  
                  
                        hibernate:
                  
                  
                          format_sql: true
                  
                  
                          cache :
                  
                  
                            use_second_level_cache: true
                  
                  
                            region :
                  
                  
                              factory_class: org.hibernate.cache.ehcache.EhCacheRegionFactory
                  
                  
                            use_query_cache : true
                  
                  
                            provider_class : net.sf.ehcache.hibernate.SingletonEhCacheProvider
                  
                  
                  
                  
                  
                  но hsql запросы все равно катят в базу, что говорит мне о том, что L2 cache не подключился. Энтити оформлена так:
                  
                  
                  
                  
                  
                  @Entity
                  
                  
                  @Table(name = "employees", schema = "security", catalog = "")
                  
                  
                  @SQLDelete(sql = "update security.employees set deleted_ts = current_timestamp where id=?")
                  
                  
                  @Where(clause = "deleted_ts is null")
                  
                  
                  @Cacheable
                  
                  
                  @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
                  
                  
                  class Employee : BaseUuidEntity(), CompanyRelated,UserRelated{
                  
                  
                  
                  
                  
                  Но все равно в логах огромное количество
                  
                  
                  Hibernate: 
                  
                  
                      select
                  
                  
                          employee0_.id as id1_37_,
                  
                  
                  .... и т.д. :(
                  
                  
                  Что я делаю не так?
                  
                  
                
spring.jpa.properties.hibernate.cache.region.factory_class=org.hibernate.cache.jcache.JCacheRegionFactory и в зависимости проекта надо будет <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-jcache</artifactId> <version>5.6.7.Final</version> </dependency> <dependency> <groupId>org.ehcache</groupId> <artifactId>ehcache</artifactId> <version>3.10.0</version> </dependency> версии сами подберите, т.к. это может сильно завистеть от версии Spring и соответсвенно версии Hibernate
у вас кстате Entity "перегружен" нативными запросами типа @SQLDelete(sql = "update security.employees set deleted_ts = current_timestamp where id=?") @Where(clause = "deleted_ts is null") не уверен что в таком случае кэш может чтото делать. попробуйте их убрать
Я убрала но логе все равно повторяется запрос https://gist.github.com/iva-nova-e-katerina/2c3e18ddd171c6a73fd9e6b2e6203ea7 много раз повторяется
Кстати а чем org.hibernate.cache.jcache.JCacheRegionFactory лучше стандартного?
Обсуждают сегодня