Have you checked http://forums.java.net/jive/message.jspa?messageID=212597.
I believe that will answer your question. Gul -----Original Message----- From: Ajay Aggarwal [mailto:[EMAIL PROTECTED] Sent: Friday, October 26, 2007 1:19 PM To: [email protected] Subject: OneToMany - related entry not getting persisted? I am using openjpa1.0. My main entity class is RecPolicy which has a @OneToMany relation to entity 'CallLog'. I am using FetchType.LAZY and CascadeType.ALL. See below: Public class RecPolicy { ... @OneToMany (fetch=FetchType.LAZY, cascade=CascadeType.ALL) private List <CallLog> calls; } Now I am trying to add a CallLog entry to an existing RecPolicy entry, but it's not working. My code looks like EntityManager em = factory.createEntityManager(); EntityTransaction tx = em.getTransaction(); try { tx.begin(); RecPolicy.RecPolicyId policyId = ... RecPolicy policy = em.find(RecPolicy.class, policyId); CallLog callLog = new CallLog(sid, this.fromUri, this.toUri); policy.calls.add(callLog); tx.commit(); } catch (Exception e) { if (tx.isActive()) tx.rollback(); } finally { em.close(); } When I enable openjpa logging all I see is an UPDATE sql to update the RecPolicy, but no INSERT for CallLog? Do I need to persist new CallLog above explicitly? Is 'LAZY' fetch causing this behavior?
