ManyToMany relationship not handled properly while using DataCache.
-------------------------------------------------------------------

                 Key: OPENJPA-333
                 URL: https://issues.apache.org/jira/browse/OPENJPA-333
             Project: OpenJPA
          Issue Type: Bug
          Components: datacache
    Affects Versions: 1.0.0
         Environment: Linux Fedora 6 2.6.22.1-32.fc6
Java SE 1.5.0_11
            Reporter: Ekin Sokmen
             Fix For: 0.9.0


We are implementing WS-methods using POJOs and OpenJPA. Following description 
is a simplified model of the issue we are facing. There is also a test case 
attached which demonstrates the described problem.

Assume that we have 2 entities EntityA and EntityB in ManyToMany relationship. 
We are going to create a new instance of EntityA and add an existing instance 
of EntityB to it. We are creating a new POJO instance of EntityA and add a 
fully populated offline instance of EntityB to it. This instance of EntityA is 
serialized and sent to the server where we are just doing "persist" on this 
entity. Without DataCache this is working fine. 

If we enable DataCache and create a new instance of EntityA as described above 
the entity is persisted successfully but if we retrieve the instance using 
OpenJPA we get the instance of EntityA but the list of EntityB is not populated 
properly, which means we have a set of EntityB which is not null and the size 
is >0 but the content is just null.

As a hint: if we debug the code we end up just after commit of new instance 
where the cache is updated. The enhanced method "pcFetchObjectId" of EntityB is 
called but the EntityB is a detached object so it returns null and the list of 
EntityB in EntityA consists of a list of nulls. 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to