-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: second level cache and entity identity
PostPosted: Wed Sep 21, 2005 1:32 pm 
Newbie

Joined: Wed Sep 21, 2005 1:28 pm
Posts: 2
Hibernate version: 3.1

Could anyone tell me which entity identity (JVM object identity, database identity or equals method identity?) is used while hibernate checks if entity is in second level cache?

thx
Tomasz Lewandowski


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2005 3:06 pm 
Pro
Pro

Joined: Fri Sep 02, 2005 4:21 am
Posts: 206
Location: Vienna
Hope someone will correct if I'm wrong, but I'd definitely expect it to be equals method identity.

Erik


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2005 4:30 pm 
Newbie

Joined: Wed Sep 21, 2005 1:28 pm
Posts: 2
after a while of thinking :) i worked it out that hibernate must check database identity because it doesn't have any other information about entity
thx
Tomasz Lewandowski


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 22, 2005 1:29 am 
Pro
Pro

Joined: Fri Sep 02, 2005 4:21 am
Posts: 206
Location: Vienna
tlewandowski wrote:
after a while of thinking :) i worked it out that hibernate must check database identity because it doesn't have any other information about entity

Though you may be right in the conclusion, I don't agree that Hibernate as no other information about entity - the equals method exists for every object, so Hibernate could (and in my opinion does) use it.

To find out try to define an equals method that doesn't fit database identity and see what's happening.

Erik


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 22, 2005 2:05 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
For second level caching it uses the id values. The objects themselves are not put into the cache; the object is "disassembled" and that disassembled state is what is put into second level cache.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.