The FAQ says:
I'm using a one-to-many association with a NOT NULL constraint on the key column and Hibernate causes constraint violations.
...
Or, for a unidirectional association, use <key not-null="true" ... /> in the collection mapping.
However, it seems not-null isn't an attribute for key. My program works if I remove the constraint, but I'd rather not do that and keep my dba happy if I can. I'm attempting to put it on the key column under the bag:
<bag name="SomeValues" table="hibernatechilld" cascade="all">
<key not-null="true" column="parent_id" />
<one-to-many class="HibernateTest.someValue, HibernateTest"/>
</bag>
I get an error stating that's not valid. What's the real answer for unidirectional, or is bi-directional a requirement?
|