Hi I have a parent object Its primary key is auto increment field in MYSQL This is simply pare ntID
now parent ID also exists in the child object as a foreign Key
So inserting Parent works fine Inserting child has a blank parent ID in its foreign key field I do not have foreign key constraint in place on the database as i would get a foreign key constraint error then
But how can I get Hibernate to insert a row, pick up on the new primary key, set that key in the child rows
my child rows are a List in the parenet. The list is set to cascade="all"
I am saving by session.save(parent) session.commit();
Can give working sample code or link to a comprehenise example please
|