-->
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.  [ 4 posts ] 
Author Message
 Post subject: sets are null after retrieving the obj
PostPosted: Wed Nov 02, 2005 6:16 pm 
Beginner
Beginner

Joined: Tue Jul 12, 2005 1:50 pm
Posts: 26
Hibernate version: 3.0

Before with hibernate2 we could access sets of an object after loading that object whether lazy was true or false for the set.
But with hibernate3.0, sets are null either with lazy=true or false

Code:
payment = (Payments) session.get(Payments.class, paymentid);
myset = pay.getPaymentCheckSet();
//here my set is empty????

here the set definition in mapping:
Code:
<set
inverse="true"
lazy="false"
name="PaymentCheckSet">
<key column="PaymentsID" />
<one-to-many class="PaymentCheck" />
</set>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 3:09 am 
Regular
Regular

Joined: Thu Oct 27, 2005 8:06 am
Posts: 55
Location: München, Germany
Do you really have pay instead of payment in your 2nd line of code? Shouldn't have worked in any Hibernate version.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 11:30 am 
Beginner
Beginner

Joined: Tue Jul 12, 2005 1:50 pm
Posts: 26
Sorry I misspelled pay and payment.
pay=(Payments)session.get(Payments.class, paymentid);


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 1:50 pm 
Beginner
Beginner

Joined: Tue Jul 12, 2005 1:50 pm
Posts: 26
I solved my problem.
In my method that I was creating the payment, after save I wanted to retrieve the check sets. But because both of save and retrieve are in one transaction, sets were not created yet. Either I had to retrieve my sets in another session, or get checks with query.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.