-->
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: problem with hibernate conversion
PostPosted: Wed Jul 22, 2009 7:19 am 
Newbie

Joined: Wed Jul 22, 2009 6:19 am
Posts: 2
Hi!

I've got a problem with hibernate conversion:
I've got two tables, T1 and T2; one references the other. In the first one, 'var1' field can be null; and it's a foreign key to 'var2' from T2, where is the primary key and it can not be null.
Then I've got two DAO object (obj1 corresponding to T1 with var1 attribute, which references to var2 attribute from obj2 corresponding to T2), with their corresponding hibernate mapping (*.hbm.xml).

When I fill the form up, and select field is not selected (due to attribute "emptyOption=true" from '<s:select...' property), hibernate don't fill obj1.var1 with null value, but create an instance of T2 hibernate mapping object and fill it up with an unexisting value (obj1.var1=0, when obj2.var2={1,2,3,4}). Then when I try to save the object with 'session.save(obj)', it turns to an exception because of that value doesn't exist in T2.

It is any way to force hibernate not to create an object but to fill it up with null value???

Thanks.


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.