-->
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.  [ 1 post ] 
Author Message
 Post subject: 2nd level cache BUG/Problem when changing Hibernate Session
PostPosted: Fri Jun 25, 2004 6:59 am 
Beginner
Beginner

Joined: Wed May 12, 2004 4:27 am
Posts: 21
Location: Montreux (CH)
Hello,

I love cache... and I found either a bug or I use it wrong !!

Imagine this :

Person (id, name, getChildren(), getParents() );
PersonRelation (person_child_id, person_parent_id, int value);
this gives me PersonRelationPK .....

here is my problem.... I define queries in the xml file :
From Person
From PersonRelation
From Person p left join fetch p.children
From Person p left join fetch p.parents

then I do :
SESS1 = createSession()
for all queries Q, i++:
SESS1.getNamedQuery(Q).setCachable(true).setCacheRegion("HERE-" + i).list().iterator();

then I can do :

Person P = getPerson(ID=3)
for (Iterator iter = P.getChildren().iterator ; .....)
....

without problems.... (I means no SQL request done)

but if I close the Hibernate connection and create a new one :

Person P = getPerson(ID=3)
for (Iterator iter = P.getChildren().iterator ; .....)
....

for each relation, Hibernate does the following request :
select parent, child, type from personrelation where parent=? and child=?

what do I do wrong ??

please help me.... my cache would finally be ok :-)


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

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.