Hi,
I have a Parent & Child tables, now i want to insert into both the table under same transaction. I have a many-to-one mapping in my child table's hbm file. I get Transaction object by saying
Code:
session.beginTransaction();
now if i insert into parent by saying
Code:
session.save(parent)
and then I say
Code:
session.save(child);
At the end i commit the transaction. In case of any exceptions I rollback the transaction. but without issuing a commit() after saving the parent I get an error because of referncial constraint I have in my DB. But if I commit after saving my parent I cant rollback if something goes wrong while inserting child.
Any help appreciated.