Hibernate does not allow me to persist an object that contains an null embedded object with an integer field.  For example, if I have a class called Thing that looks like this

@Entity
public class Thing {

    @Id
    public String id;

    public Part part;

}


where Part is an embeddable class that looks like this

@Embeddable
public class Part {

    public String a;    

    public int b;

}


then trying to persist a Thing object with a null Part causes Hibernate to throw an Exception.  In particular, this code

Thing th = new Thing();
th.id = "thing.1";
th.part = null;
session.saveOrUpdate(th);


causes Hibernate to throw this Exception

org.hibernate.PropertyValueException: not-null property references a null or transient value: com.ace.moab.api.jobs.Thing.part


My guess is that this is happening because Part is an embedded class and so Part.a and Part.b are simply columns in the Thing database table.   Since the Thing.part is null Hibernate wants to set the Part.a and Part.b column values to null for the row for thing.1.  However, Part.b is an integer and Hibernate will not allow integer columns in the database to be null.  This is what causes the Exception, right?

So I am looking for workarounds for this problem.  I noticed making Part.b an Integer instead of an int seems to work, but for reasons I won't bore you with this is not a good option for us.  Thanks!


Question: Why do I have to explicitly add perl before the script for getops to run properly?
Answer: fixed and this question was a repeat... http://stackoverflow.com/questions/1695188/how-do-i-make-perl-scripts-recognize-parameters-in-the-win32-cmd-console

The OP of that post figured it out.
I had to do the same but also recreate the assoc in the gui (in addition to in the reg and on the command line with ftype.)

Thanks everyone for your help!