-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matthias
Bohlen
Sent: Friday, February 11, 2005 4:25 PM
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.
[CB] I think a better solution would be to fix the metafacade operation that
does the check instead of setting them all to be all-delete-orphan. I'll
take a look.
What do you think?
Matthias
---
Matthias Bohlen
"Consulting that helps project teams to succeed..."
Internet:
http://www.mbohlen.de/
[EMAIL PROTECTED]
Phone: +49 (170) 772 8545
-------------------------------------------------------
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