oracle - one-to-many relationshipt with database constrain and inverse=true -
there 2 classes , b , hibernate mappings
<hibernate-mapping default-lazy="false"> <class name="a" table="a"> <id name="id" type="long"> <generator class="sequence"><param name="sequence">a_sequence</param></generator></id> <set name="a" cascade="all" inverse="false" > <key><column name="a_fk" not-null="true" /></key> <one-to-many class="b" /></set> </class> </hibernate-mapping> <hibernate-mapping default-lazy="false"> <class name="b" table="b"> <id name="id" type="long"> <column name="id"/> <generator class="sequence"><param name="sequence">b_sequence</param></generator></id> </class> </hibernate-mapping>
on database there not null contraint , foreign key constraint on column a_fk of table b. when try insert contains b following error:
ora-01400: cannot insert null ("schema"."b"."a_fk")
is possible insert kind of data without having specify inverse=true flag? , inverse relationship?
not without getting rid of way id generated. can switch how id generated?
Comments
Post a Comment