This content has been marked as final.
Show 3 replies
-
1. Re: Many-to-Many and cascade pronlem ?
fhh Apr 15, 2007 6:37 PM (in response to ericmacau)When I tried to remove User, it will remove all the roles in the ROLE that the user has and also all the related records in the USER_ROLE_LINK.
I would say this is the expected behavoiour. You asked to remove the user and all of his roles.
And how can I remove all the users that a role have when remove a ROLE ?
Have you tried removing the CasadeType.ALL and replace it with the cascade types you actually want?
Regards
Felix -
2. Re: Many-to-Many and cascade pronlem ?
ericmacau Apr 15, 2007 9:29 PM (in response to ericmacau)Hi,
I tried to use CascadeType.REMOVE, but it got the same result.
I just want to remove the USER and its relationship when removing a user.
Please help, I tried many ways but also failed.
Best regards,
Eric -
3. Re: Many-to-Many and cascade pronlem ?
fhh Apr 16, 2007 4:36 AM (in response to ericmacau)If you do NOT want to cascade on remove then don't set it. The cascade options refer to the Java objects NOT the representation in the database.
The rows from the ManyToMay JoinTable will get removed WITHOUT any cascading options set because removing the User and not the rows in the join table would violate a fk constraint.
Regards
Felix