Hi,
       As mentioned in the email below, em.merge() returns a managed object. 
Since Verfahrenstatus  gets merged internally by OpenJPA, not explicitly by the 
API call, the application can not get the merged object for Verfahrenstatus 
immediately after the em.merge call. The workaround is to comment out 
em.merge() 
and immediately call commit as shown below. That way, the id for s1 will be set.

        Verfahrendokument d1 = em.find(Verfahrendokument.class, did);
        em.getTransaction().begin();
        Verfahrenstatus s1 = new Verfahrenstatus();
        s1.setVerfahrendokument(d1);
        s1.setStatus(2);
        d1.addStatus(s1);
        //em.merge(d1);
        em.getTransaction().commit();
  
Regards,
Fay





----- Original Message ----
From: Fay Wang <[email protected]>
To: [email protected]
Sent: Wed, September 29, 2010 9:57:28 AM
Subject: Re: @OneToMany list object problem with IDENTITY keys

Hi,
       I am able to see the problem you reported. Note that em.merge(entity) 
returns a managed object and Verfahrenstatus gets merged internally/implicitly 
by OpenJPA along with Verfahrendokument. It appears that OpenJPA fail to set 
the 

Id for Verfahrenstatus after merge. I will investigate further for the 
resolution of this problem.

Fay



----- Original Message ----
From: mpf <[email protected]>
To: [email protected]
Sent: Wed, September 29, 2010 7:01:35 AM
Subject: Re: @OneToMany list object problem with IDENTITY keys


At least someone can tell me if im going right that the ID had to be set?
-- 
View this message in context: 
http://openjpa.208410.n2.nabble.com/OneToMany-list-object-problem-with-IDENTITY-keys-tp5583159p5584026.html


Sent from the OpenJPA Users mailing list archive at Nabble.com.


      

Reply via email to