Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

How to use org.redisson.codec.JsonJacksonCodec in Redisson for custom object serialization and deserialization?

I am using Redisson in my project to interact with Redis. I want to use org.redisson.codec.JsonJacksonCodec for serializing and deserializing my custom objects. However, when I configure Redisson with ...
QuangBui's user avatar
0 votes
0 answers
23 views

Hibernate Infinispan second level cache StackOverflowError

Is there a way to prevent the error in case of hierarchical (single table inheritance) entity model with lots of circular dependency e.g class A extends BaseClass { @ManyToOne(fetch = FetchType.LAZY)...
kamilx2's user avatar
  • 191
0 votes
2 answers
31 views

env variable not loading in properties file

I am trying to add a conditional yaml config file in a properties file but it's not able to read the env variable hibernate.cache.redisson.config=redisson-${REDIS_MODE}.yaml it is giving error ...
Ganesh Prajapati's user avatar
1 vote
1 answer
541 views

Errors running builder 'CDI (Contexts and Dependency Injection)

Am using Eclipse with JBoss Tools to develop JSF 2.3 & JPA 2.2 based web application for Apache TomEE 8.0.16 server with Hibernate as JPA implementation. My project has many drop down menus and ...
శ్రీ's user avatar
0 votes
0 answers
23 views

Why does JPA not use the 1st level cache for this query?

I've got the below two queries.These queries are more or less the same - the only difference is that the second query also does a left join on a collection to fetch that collection. When I try to ...
sbrattla's user avatar
  • 5,388
1 vote
0 answers
66 views

Spring Data JPA: Hibernate Query Cache is invalidated even if unrelated records are added, modified or deleted

Hibernate Query Cache is getting invalidated even if unrelated record is added, deleted or modified. Entity @Entity @Cache(region = "book", usage = CacheConcurrencyStrategy.READ_WRITE) ...
mzr's user avatar
  • 69
0 votes
2 answers
3k views

hibernate v6, caching | XmlConfigurationException: Error parsing XML configuration

I have a working hibernate v6 project and want to add caching, but I can't get it working. I get this error (reduced) Exception in thread "main" java.lang.IllegalStateException: Cache ...
Carry out's user avatar
1 vote
2 answers
458 views

Unable to create requested service [org.hibernate.cache.spi.CacheImplementor] Hibernate Cache in Spring Boot

I am trying to hibernate cache in Spring dao layer. I get an error when I add the ehcache dependency. application.properties spring.jpa.properties.hibernate.cache.use_second_level_cache=true spring....
kernel's user avatar
  • 733
-1 votes
1 answer
703 views

The entity field value is updated after exception throwing and transaction rollback

I have developed a test project to reproduce this issue. This is a project structure: pom.xml file: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://...
Дмитрий Бабанин's user avatar
6 votes
2 answers
5k views

Hibernate cache vs spring cache

Can anybody explain what is the difference between hibernate second level cache vs spring cache.? Does it make sense to use both in single application? If it is not recommend then when to use which ...
Sachin Dave's user avatar
1 vote
1 answer
2k views

Hibernate cache levels 1 and 2 [duplicate]

What is the difference between 1st level and 2nd level caching in Hibernate ? Hi, I am learning Hibernate. I read some docs about 1st and 2nd level caching. What is the difference between them ? Its ...
Popovych Taras's user avatar
0 votes
1 answer
151 views

Does EntityManager.getReference() matter if the entity is @Cached/@Cacheable?

Say I want to update entity A which references B but B is a big entity. If B is not a cached entity (2nd-level), I normally do a getReference() if I have access to B's PK to avoid the extra SELECT ...
Rey Libutan's user avatar
  • 5,304
0 votes
1 answer
670 views

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

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 ...
user avatar
1 vote
0 answers
24 views

Upgradation of Hibernate version to 4.0.0 from 3.x

Using jSpaces-1.0.jar to implement Gigaspaces as second level cache. Till, Hibernate 3.6 v it is working fine. When upgrading the version to 4.0, many cache related classes are depricated. How to ...
Sneha Singh's user avatar
0 votes
1 answer
659 views

Hibernate L2 cache issues with EntityGraph and LEFT JOIN FETCH queries

I'm using hibernate 5.3.14 with hazelcast 3.11.5 as L2 cache provider and spring boot 2.1.11. I have 3 entities defined with relations: one order has many order items one order has many custom fields ...
Ionut B's user avatar
1 vote
2 answers
1k views

LazyInitializationException when fetching @EntityGraph from Hibernate 2-nd level cache

I'm developing a Spring Boot 2.3.4 web application with Spring Data JPA. I want to use the Hibernate 2-nd level query cache for a repository method with @EntityGraph. However, I get a ...
Bartek Kołakowski's user avatar
0 votes
0 answers
301 views

caching relations mapped by other entity

I'm trying to cache some of my entities that only get changed when the server is down. Here is an example: @Entity @Cache(usage=CacheConcurrencyStrategy.READ_ONLY) public class Season { @Cache(...
EasterBunnyBugSmasher's user avatar
0 votes
1 answer
477 views

Where does external caches like ehcache / redis fit w.r.t hibernate level 1 / level 2 caches?

Hibernate (and so JPA which is wrapper on hibernate) provides two levels of caching mechanisms. a) level 1 cache which is at session object layer/level b) level 2 cache which is at session factory ...
user avatar
0 votes
1 answer
575 views

Spring Boot Application and Hazelcast NearCache

I am trying to use Hazelcast caching with Spring Boot, having read some documentation I decided to settle for Near Cache configurations, I would like to cache some method calls and use it for ...
tinashe.chipomho's user avatar
0 votes
0 answers
408 views

Natural ID with Hibernate Second Level Cache

I am working on a Spring boot project where i am using Hibernate as ORM. I have enabled Hibernate Second Level Caching. I have an entity called Country. In country i have a natural Id and i have ...
Ajay Sankaran's user avatar
2 votes
1 answer
929 views

Hibernate query cache doesn't work when criteria implies date

I have the following query: public List<SomeEntity> findArticlesById(String id) { final CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); final CriteriaQuery<...
Fabrizio Stellato's user avatar
5 votes
0 answers
463 views

Hibernate Second level cache doesn't work for OneToOne associations

I am trying to enable Hibernate's 2nd level cache but cannot avoid multiple queries being issued for OneToOne relations. My models are: @Entity @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) ...
Heits's user avatar
  • 747
1 vote
0 answers
171 views

Hibernate Returns Wrong List From Cache Even Expected List is Different Than the Cached One

In the code below if I don't clear current session, just the number of girls is returned from the method even if I want to return number of all children of this parent. It's clearly seen that parent ...
H.Ç.T's user avatar
  • 3,539
0 votes
0 answers
318 views

Infinispan - Hibernate 2nd Level Cache Cluster Marshaling issue

We are trying to configure infinispan as the 2nd level cache for Hibernate in Jboss EAP 7.1 and run the jboss in clustered two node setup. Lookup for cache elements works, but if we update hibernate ...
rockycres's user avatar
1 vote
0 answers
49 views

query by example result caching using spring boot 2 hibernate 5

I have a table with lot of columns (almost 70) and rows (1.4 Million). However the data gets updated very rarely. I want to cache the table entities for faster queries. Queries can be of any ...
nightfly's user avatar
  • 455
1 vote
0 answers
2k views

How to reference a class file located inside a spring boot maven JAR file in spring boot's application.property file

I have a Spring Boot Camel project which uses Hibernate and its L2 cache system enabled. The L2 Cache provider I used is Redis and the application connects through Spring Redission starter. I ...
suraj vijayakumar's user avatar
1 vote
1 answer
394 views

Hibernate 2nd level cache not working with GORM 6.1.11

Issue: I have a criteria query where Hibernate's 2nd level cache is used in using cache(true): User user = User.createCriteria().get { eq("id", 1l) cache(true) } When this code is hit two ...
Shashank Agrawal's user avatar
0 votes
2 answers
1k views

Circuit-break L2 cache in Hibernate in case of redis connection issues

I am using redisson-hibernate as Hibernate 2nd level Cache provider. If redis server becomes unavailable, while the application is running, the whole application goes down. I am trying to find a way ...
Aayush's user avatar
  • 83
1 vote
1 answer
95 views

Which existing entity will be evicted from cache by hibernate before adding the new entity into cache when cache memory is full?

I am setting up EHCache in hibernate project. What happens if the cache got full? Suppose there all the entities are valid in the cache and hibernate wants to add the new entity into it. Then which ...
Laxminarayan's user avatar
1 vote
0 answers
434 views

Hibernate caching not working for inverse side of one-to-one relationship

I tried googling this and found a possible duplicate of the question, but I cannot preview it: https://stackoverflow.com/questions/49344593/inverse-side-one-to-one-relationship-caching-not-working ...
igobivo's user avatar
  • 432
1 vote
1 answer
565 views

EhCache 2.10.x is very heavy

Using Maven, I updated our Hibernate version to 5.x and it comes now transitive with EhCache 2.10.x. This version is very heavy (about 10 Mb). This is annoying in a small application. The JAR includes ...
LaurentG's user avatar
  • 11.6k
0 votes
1 answer
400 views

Grails return just id of entity

I have an entity Product and inside of entity, i have Contry entity. When i execute Product.find or Product.get and get country value, my country values has just id value, but in country entity i ...
Mister B's user avatar
  • 123
1 vote
2 answers
1k views

JPA cache behaviour when invoke count() method on Spring Data JPA Repository

I'm writing a transactional junit-based IT test for Spring Data JPA repository. To check number of rows in table I use side JDBCTemplate. I notice, that in transactional context invoking of org....
qwazer's user avatar
  • 7,474
1 vote
1 answer
702 views

is it necessary for query caching region to be same as entity caching region

in my project i have enabled hibernate query caching (using ehcache) and 2nd level entity caching for some of the entities . also in the documentation it is mentioned that query caching does not store ...
Mayur's user avatar
  • 313
0 votes
1 answer
146 views

shared infinispan 2LC cache

I have two applications using same database entities. Both applications are deployed on jboss eap 6.2 separate clusters. DB tables are updated only from one application but are read from both ...
priyam's user avatar
  • 104
1 vote
1 answer
190 views

How to enable JMX statistics for infinispan 2LC in Jboss EAP 6.2

I have enabled 2LC in my application deployed over JBoss EAP 6.2 using infinispan. I want to measure performance gain and want to enable JMX statistics for infinispan to see cache hits/misses etc. In ...
priyam's user avatar
  • 104
2 votes
1 answer
468 views

Why we are getting exception when we enable the query-cache in hibernate.cfg.xml file by use hibernate 5.3.1.Final dependency?

I created a small second level cache program by using 'hibernate 5.3.1.final' dependency.I used below dependencies to work with Second level cache. <dependency> <groupId>org.hibernate&...
Raghavendra Sonu's user avatar
0 votes
0 answers
292 views

Hibernate return last fetch and modified object instead fetch new one

my problem is this. ill try to make it simple. I am using spring data jpa +spring boot (hibernate config) with mysql. I have a class (entity) like this. public class A { @EmbeddedId Aid id; @...
Derek Noble's user avatar
1 vote
1 answer
535 views

Access database by hibernate from multiple JVM instances

My application is running in multiple JVM instances (in separate docker containers). The application uses hibernate (and spring-data-jpa) to access the single database (MySQL) instance. Do I need to ...
t777's user avatar
  • 3,299
2 votes
0 answers
315 views

Hibernate first level cache when using projection

Hibernate uses first level cache by default and cache the queries or i say entities for a session. But what about projection. Lets say i have fired a join query from 3 table and get a small ...
Ankit Bansal's user avatar
  • 2,348
12 votes
2 answers
899 views

Apache Ignite hangs on startup

We use apache ignite v2.2 as hibernate 2nd level cache in grails application. We have 4 nodes cluster with 10G RAM each. The first node starts ok. But subsequent hangs. Sometimes 2nd sometimes 3rd or ...
Dmitry S's user avatar
  • 121
1 vote
0 answers
107 views

Hibernate caching on dynamic changing parameters

I have a sample hibernate sql statement as below. As this query has three bind parameters which will vary for different criterias, Would PostComment Entity be eligible for ehcache in Hibernate? please ...
Pattabhi's user avatar
  • 855
2 votes
1 answer
4k views

Another unnamed CacheManager already exists when using Hibernate L2 ehcache and spring boot enabledCache

I have an application that have more than 100 domain model i want to integrate ehcache and hibernate L2cache ,my application used ehcache for cache some of service s methods . my CacheConfiguration is ...
ali akbar azizkhani's user avatar
0 votes
1 answer
335 views

How to handle Hibernate cache when I have 2 applications with different DAO implementations

I have two web applications uses the same database Management web app which responsible to modify the system configurations on the database. Business web app which responsible to serve the users ...
Osama Abu Qauod's user avatar
0 votes
1 answer
594 views

How to resolve hibernate caching exception

I can see caching exception sometimes only, I am not able to reproduce as well. So just wanted to know how shall I proceed. We are using Jboss As 5.1 and Hibernate 3.3.2.GA version We have an entity ...
Arvind's user avatar
  • 1,237
2 votes
0 answers
211 views

ecache configuration in spring throws: "Named query not known Error"

Trying to run a unit test on a Dao in my Spring app I'm getting error: Named query not known. Actually I'm trying to implement cache with spring 4.2. Here is the code that is relevant to the ...
Created Bylucky's user avatar
2 votes
1 answer
306 views

Does Session.list() method use session cache in hibernate?

Does Hibernate cache the results get from Session.list()? What my believe is session.get() or session.load() method cache the result in the memory but session.list() doesn't as it generate lots of ...
Rohit's user avatar
  • 450
1 vote
0 answers
717 views

hibernate second level cache can get lazy-loading entity when i set breakpoint

I use Spring data JPA and hibernate second level cache via hibernate-redis in my project. I use @Transactional for lazy-loading, But it hints miss when I run application. if i debug it, and set a ...
Joemsu's user avatar
  • 11
0 votes
1 answer
2k views

Doesn't session.get() in hibernate always hit the database?

Theoretically, session.get() method is supposed to hit the database always, no matter whether the entity is stored in the cache or not. But whenever I use session.get() or session.load(), both doesn't ...
user avatar
7 votes
1 answer
12k views

Ehcache migration from 2.6 to 3.00

I am trying to upgrade Ehcache for my Project from 2.6 to 3.0 version. Any replacement for net.sf.ehcache.Element and CacheExceptionHandler. Less documentation on Ehcache 3, Can anyone give some ...
Cork Kochi's user avatar
  • 1,871