[
http://jira.jboss.com/jira/browse/EJBTHREE-960?page=comments#action_12365923 ]
Fritz Feuerbacher commented on EJBTHREE-960:
--------------------------------------------
After doing some investigating it looks like the CascadeType applies to the parent bean.
So, if you delete the parent, it will cascade down and delete all the relationships and
remove the data from the relations table. But, if you just modify the relationship in the
parent bean, like remove and item from a onetomany list, and merge, it modifies the
parents relationship, but it doesn't remove the data in the relationship table. The
client is responsible for deleting each bean that was removed from the parents
relationship by calling delete on each object individually.
So, the Jboss 4.0.5 upgrade is correct.
CascadeType REMOVE in relationships doesn't appear to cascade
anymore.
----------------------------------------------------------------------
Key: EJBTHREE-960
URL:
http://jira.jboss.com/jira/browse/EJBTHREE-960
Project: EJB 3.0
Issue Type: Bug
Environment: Windows XP, JBoss AS 4.0.5.GA
Reporter: Fritz Feuerbacher
Since I upgraded from JBoss 4.0.4.GA to 4.0.5.GA I have encountered this problem.
Whenever I have an entity bean that has a relation in it I get strange behavior that I
didn't have in 4.0.4.GA.
Examples:
Say I have an entity bean with a relation in it like:
@OneToMany (mappedBy="user",
cascade={cascadeType.ALL}),
fetch=fetchType.EAGER)
public List<UserAndRole> getUserAndRoles()
{
return userAndRoles;
}
This works fine, and will cascade in all instances except if I take an existing bean
and set the list to an empty list like:
userAndRoles = new ArrayList<UserAndRole>();
and then call merge on the entity bean. It appears to remove the relationship in the the
bean, however, the old entries in the table are still there. In JBoss 4.0.4.GA, doing
this would also remove the entries in the UserAndRoles table that corresponded to the
items that were in the original userAndRoles list. Definately something has changed
between the versions. I just can't figure out what.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira