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.
|