I used Seam gen to create my project.
I'm trying create integration tests for my code. I'm currently using the default Hypersonic database. Unfortunately, I'm having issues with a @ManyToOne annotation on my entity. If I mark a field with the ManyToOne annotation and is marked as optional (I've also tried this if I remove the optional attribute, which if true, is not required):
@ManyToOne(optional = true) private User approvedby = null;
However - I'm not sure if it's an issue with Hibernate or Hypersonic, but the corresponding SQL INSERT INTO statement does not contain the value with this field, even if the field is populated with nonnull data - i.e. this field in the INSERT INTO statement is always null even if the corresponding field in the DBUnit flat file is not null.
This is an issue with optional attribute being set to true - because if I change optional to false:
@ManyToOne(optional = false) private User approvedby = null;
The data are always properly inserted in the INSERT INTO statement (I check the Hypersonic logs). Unfortunately, I cannot mark the annotation with optional as false in my case, so what is going on here? Is this an issue with Hypersonic or Hibernate?