From: Mark W. <mor...@al...> - 2002-08-30 09:01:16
|
Hi all... Is there a way for Hibernate to persist the parent before any children? I've an object Foo which has a child Bar, and the mapping looks like this: <class name="Foo"> <id name="id"> <generator class="assigned" /> </id> <one-to-one name="bar" class="Bar" /> </class> <class name="Bar"> <id name="id"> <generator class="assigned" /> </id> </class> I'm having problems because Bar's id must be a foreign key into Foo. Because Bar gets created before Foo, I get a constraint violation. Is there a way around this? I suspect that this would also be necessary to support normalized mappings. Thanks, -Mark |