-->
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.  [ 2 posts ] 
Author Message
 Post subject: Binding problem
PostPosted: Tue Jan 20, 2004 6:34 pm 
Newbie

Joined: Wed Jan 14, 2004 4:44 pm
Posts: 13
Location: Wellington, New Zealand
I can't work out why values from the beans aren't being bound properly. This is my code:

Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();

InterviewQuestion iq = (InterviewQuestion)f.get("generic_1"); //from UI

session.lock(iq, LockMode.READ);
Iterator iter = iq.getAnswerOptions().iterator();

while(iter.hasNext()) {
AnswerOption ao = (AnswerOption)iter.next();
if(ao.isSelected()) {
iq.addInterviewAnswer(new InterviewAnswer(iq, ao)); // not binding
}
}

session.saveOrUpdate(iq); // cascade="save-update" in config
tx.commit();
HibernateUtil.closeSession();

This is the (cut down) log that shows nulls being bound:

Hibernate: insert into Interview_Answers (INTERVIEW_QUESTION_ID, ANSWER_ID, ID) values (?, ?, ?)
net.sf.hibernate.type.LongType - binding null to parameter: 1
net.sf.hibernate.type.LongType - binding null to parameter: 2
net.sf.hibernate.type.LongType - binding '2' to parameter: 3

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 20, 2004 6:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Have you read http://www.hibernate.org/hib_docs/reference/html/parent-child.html ?


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