Joined: Mon Aug 30, 2010 10:29 am Posts: 2
|
I have two tables with parent/child relation. Child table have two columns, both columns make a primary key. Parent's key is one of the primary keys in child table but parent/child has one-to-many relationship so "generated key" in child table is not unique. Uniqueness is defined by combination of columns in child table. I have cascade="all" between parent/child tables. If cascading insert tries to insert more than one records of same generated key in child table then hibernate throws "noUniqueObject" exception...anyone knows how to solve this?
<id name="c1" type="int"> <column name="column1"/> <generator class="foreign"/> <param name="property">column1</param> </generator> </id>
Since there is one-to-mant relation between parent-child above configuration throws "noUniqueObject" exception at cascading insert. I tried to define Composite-id in child table's hbm having both columns but that throws exception too. "INSERT statement conflicted with COLUMN FOREIGN KEY constraint "
|
|