Questions tagged [hibernate-cache]
73 questions
1
vote
1 answer
Hibernate cache levels 1 and 2
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 very hard to understand from the docs. It seems…

Popovych Taras
- 35
- 1
- 5
1
vote
0 answers
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 implement second level cache using jSpaces-1.0.jar…

Sneha Singh
- 11
- 1
1
vote
2 answers
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 LazyInitializationException when generating a Thymeleaf view in…

Bartek Kołakowski
- 11
- 3
1
vote
0 answers
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 with id 1 has three children (2 girls and 1 boy),…

H.Ç.T
- 3,335
- 1
- 18
- 37
1
vote
0 answers
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 combination of filter on one or multiple of the columns…

nightfly
- 425
- 2
- 8
- 18
1
vote
0 answers
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 package the application through maven (basically a FAT…

suraj vijayakumar
- 47
- 1
- 4
1
vote
1 answer
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 times, 1st time it makes the database query which is…

Shashank Agrawal
- 25,161
- 11
- 89
- 121
1
vote
1 answer
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 entity will be evicted by the hibernate to add this…

Laxminarayan
- 188
- 2
- 16
1
vote
0 answers
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
Given two domain model classess:
@Entity
@Table(name…

igobivo
- 433
- 1
- 4
- 17
1
vote
1 answer
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 lot of .class files from J2EE, like…

LaurentG
- 11,128
- 9
- 51
- 66
1
vote
2 answers
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.springframework.data.repository.CrudRepository#save(S)…

qwazer
- 7,174
- 7
- 44
- 69
1
vote
1 answer
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 the complete entity object and only stores the…

Mayur
- 303
- 1
- 3
- 14
1
vote
1 answer
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 EAP 6.3 onwards we can add…

priyam
- 74
- 7
1
vote
1 answer
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 disable some hibernate cache (e.g. the…

t777
- 3,099
- 8
- 35
- 53
1
vote
0 answers
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 advise.
select pc from PostComment pc join fetch…

Skanda
- 835
- 1
- 15
- 32