[
http://jira.jboss.com/jira/browse/EJBTHREE-941?page=comments#action_12388867 ]
Barak Merimovich commented on EJBTHREE-941:
-------------------------------------------
While the behavior displayed in JBoss seems compatible with the JPA spec, it would be
REALLY good to support both options, i.e. allow for the deleting of child entities in the
DB during a merge.
Perhaps merge is the wrong name for the operation. Maybe 'mirror' is a better one,
or 'sync'.
merge issue when removing from OneToMany in detached state (layered
architecture)
---------------------------------------------------------------------------------
Key: EJBTHREE-941
URL:
http://jira.jboss.com/jira/browse/EJBTHREE-941
Project: EJB 3.0
Issue Type: Bug
Affects Versions: AS 4.2.0 GA
Environment: 13:37:59,625 INFO [ServerInfo] Java version: 1.5.0_09,Sun
Microsystems Inc.
13:37:59,625 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.5.0_09-b01,Sun
Microsystems Inc.
13:37:59,625 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
Reporter: Rico Apfelbeck
We work on a client-server environment with a webstart-client with an own JVM. Only the
server has access to the JPA. POJOs are transfered from client to server and back.
Our Issue occurs in the following workflow:
- We get an Object A on the server from the Entitymanager and transfer it to the client.
- This Object has a OneToMany-relation to some Objects B (fetchtype: EAGER, cascade:
ALL). In B we have a reference to A.
- On the client we remove in A some B from the Set, for example with clean() and transfer
A back to the server.
- We merge A on the server.
- There is no exception thrown.
The returned A from the merge-call does not contain any B, reloading A by Id results in a
restored list containing the removed Bs.
While added new Bs to A are stored correctly, removing them doesn't result in the
deletion of the removed Bs from the database.
Updating B in the List in A results in updated Bs when merging A.
Only the removal causes problems. We assume that the problem comes from checking the now
empty list against the database.
Reloading A before merging in the server and manually compare the List of Bs, using
EntityManager.remove() when neccesary. helps our case, but that's not the way it shoud
be. :)
--
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