Questions tagged [first-level-cache]
18 questions
16
votes
1 answer
What's the point of specifying hibernate.jdbc.batch_size?
This Hibernate configuration ostensibly should control how many objects are cached in the first level cache. The reason is easy enough to understand, we don't want to run out of memory.
But something is confusing me. Every implementation I have…

alex sundukovskiy
- 483
- 1
- 7
- 19
5
votes
2 answers
JPA and first level cache, whats the point?
EntityManager maintains first level cache for retrieved objects, but if you want to have threadsafe aplication you're creating and closing entityManager for each transaction.
So whats the point of the level 1 cache if those entities are created and…

vach
- 10,571
- 12
- 68
- 106
5
votes
2 answers
Hibernate First level Cache vs Query Cache
Is first level cache different from query cache in hibernate? I have seen articles mentioning about first level and query cache, so i am confused.

java_geek
- 17,585
- 30
- 91
- 113
4
votes
2 answers
Can first level cache be used with ICriteria or other APIs?
In NHibernate you can easily benefit from first level cache when using Load or Get methods. But what about ICriteria, HQL, Linq-to-NHibernate and QueryOver? Do they use first level cache too?

Afshar Mohebi
- 10,479
- 17
- 82
- 126
2
votes
0 answers
When does a query hit JPA 1st level cache and when the query does bypass the cache
It is clear that, by default, when we execute entityManager.find(Post.class, 1L); then the Post instance for id=1 will be retrieved and placed in 1st level cache and then if we again execute the same entityManager.find(Post.class, 1L); in the same…

Suren Aznauryan
- 984
- 10
- 24
2
votes
1 answer
Remove deleted items from first level cache in NHibernate? Or: how to check if cached items have been deleted?
We have a brownfield multi-user application (99% Delphi, 1% .net) which uses NHibernate for the persistency of the .net modules. In my application I can add categories to some entity. If I select one and decide to not use it (thus removing the…

TedOnTheNet
- 1,082
- 1
- 8
- 23
1
vote
2 answers
Hibernate first level cache is missed
I'm a newbie to JPA/Hibernate first level caching.
I have the following repository class
Each time I call the findByState method(within the same transaction), I see the hibernate sql query being output onto the console
public interface…

Navs
- 119
- 1
- 17
1
vote
3 answers
Hibernate caching
In hibernate already First level Cache is available for caching then why we have to use Second level cache? Instead of second level why we can not use only First level cache in hibernate for caching?

user3898783
- 207
- 1
- 4
- 16
0
votes
0 answers
Why does level 1 use split cache?
Generally, what processors follow is that level 1 cache is split while level 2 in unified cache. Why is it so?
I'm not aware of any processor designed in the last 15 years that has a unified (L1) cache.

Mihir Shri
- 21
- 2
0
votes
1 answer
Is all code run inside an mvc controller method in the same session?
I have the following model:
many to many between entity Foo and Bar. Foo has a LinkedHashSet of Bar annotated with @OrderBy.
Controller includes a method that first saves a new Bar to the set, and then gets all Bar from one Foo.
Set…

Claudiu Guja
- 290
- 1
- 3
- 12
0
votes
1 answer
Second level hibernate caching - Making object available at session factory level?
I have some understanding about how this first level and second level caching is used in hibernate. There are lot of questions related to this- yes I agree
But my confusion is.
In first level caching , until unless I commit the transaction, my data…

Arasn
- 138
- 10
0
votes
2 answers
Is first level cache enabled in my Castle ActiveRecord based application?
I have a simple level ASP.NET web application based on Castle ActiveRecord. How can I determine if first level cache is enabled within it or not?

Afshar Mohebi
- 10,479
- 17
- 82
- 126
0
votes
4 answers
NHibernate is loading same object multiple times - please help!
I've just been reading the trace for one of my ASP.NET pages and I've noticed that the page user is being loaded from the database each time the user is required. Since each ISession is supposed to cache objects, I'm really mystified about…

David
- 15,750
- 22
- 90
- 150
0
votes
1 answer
Managing entities in NHibernate 1st level cache
What's the proper way to manage persisted entities in the 1st level cache during thread/session lifetime? Actually, there is only one or two persisted instances per thread (session) that should be present at all times, for referencing them from…

vgru
- 49,838
- 16
- 120
- 201
0
votes
1 answer
NHibernate 1st level cache
Context: I am working on a .NET 3.5 Windows application that crashes once RAM has been completely filled by NHibernate 1st level caching.
Question 1: Does NHibernate's 1st level caching algorithm perform memory checks to ensure sufficient space…

Drigeon
- 1
- 2