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: Query creates new instances of already loaded objects
PostPosted: Mon Jul 25, 2005 4:47 am 
Newbie

Joined: Thu Jun 30, 2005 9:45 am
Posts: 3
Hi, I have a quick question based on the 2 classes below...

Code:
class Apple {
}

class Banana {
   private Apple obj;
}


Within the same session, I retrieve an object of class A using the session's "get" method. Then I do a query-by-example for Banana's, using a Banana instance with "obj" set to the just retrieved A instance. The query returns the right Banana objects, but they all point to a different instance of class A (same A entitykey, but different JVM identity).
Is it possible to do a query so that the Banana objects reference the already loaded Apple object instead of a new instance?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 25, 2005 6:30 pm 
Newbie

Joined: Wed Apr 27, 2005 5:25 pm
Posts: 2
Query results use a different cache than the session cache that loaded ones use, so I don't think that's possible.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 26, 2005 4:41 pm 
Newbie

Joined: Thu Jun 30, 2005 9:45 am
Posts: 3
Wow. I would think that, within the same session, reusing an already loaded object in the reference properties of query result objects would be more efficient. What a pile of crap.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 26, 2005 6:01 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Hillbilly wrote:
Query results use a different cache than the session cache that loaded ones use, so I don't think that's possible.


Huh?? This is of course not true.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 26, 2005 6:02 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
MarkKline wrote:
What a pile of crap.


Did you really just say that?

Any argument for why I should not ban you immediately?


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.