-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wouter Zoons Sent: Friday, February 11, 2005 4:49 PM To: 'Matthias Bohlen'; [email protected] Subject: RE: [Andromda-user] Hibernate cascade problem
I had weird issues too with this save-update thing .. per Chad's recommendation I am now using cascade="none" and it works perfectly now, but I guess nothing is cascade-deleted now :-) [CB] No it is cascade deleted, you're just not using the default "save-update". > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:andromda-user- > [EMAIL PROTECTED] On Behalf Of Matthias Bohlen > Sent: Saturday, February 12, 2005 12:25 AM > To: [email protected] > Subject: [Andromda-user] Hibernate cascade problem > > Hi all, > > in my model, there are two classes named "User" and "Address". User > has a unidirectional 1-to-1 composition to Address (black, solid > diamond on the side of Person). > > In the Hibernate mapping file generated by the Spring cartridge, I see > this: > > <many-to-one name="address" class="...AddressImpl" > outer-join="auto" unique="true" cascade="delete" not-null="true"> > <column name="ADDRESS_FK"/> > </many-to-one> > > When I execute a save() on a User object, the Address object is not > saved but an Exception is thrown, something like "attempt to save a > persistent object with a relationship to a transient object". And this > in spite of the fact that the User class has > default-cascade="save-update"! > > Question: Does the cascade="delete" override the > default-cascade="save-update"? Is this the reason why I get that > Exception? > > If so, we should change the Spring/Hibernate cartridge so that it > emits cascade="all-delete-orphans" in that case. I think I saw some > code in the metafacade that checks for this special case but it seems > not to trigger in my example. > > What do you think? > Matthias > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Andromda-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/andromda-user ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Andromda-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/andromda-user
