persistence problem in distributed environment

2009-04-11 Thread hmmahboobi
We have a critical problem in our application, we have multiple enterprise applications and we have to use distributed transactions to ensure ACID operations on entire system. Our Application server is Glassfish V9 update 5 on SUSE 10 and database is Oracle 10.2.0.1.0. The problem is when we

Re: persistence problem in distributed environment

2009-04-11 Thread rpalache
Hi, Set the cascade attribute for this field to CascadeType.PERSIST or CascadeType.ALL (JPA annotations) or persist or all (JPA orm.xml), or enable cascade-persist globally, or manually persist the related field value prior to flushing. In your example, can you please try the following and

Re: persistence problem in distributed environment

2009-04-11 Thread Paul Copeland
unmanaged means the Account object assigned to the ManyToOne field is new and not yet persistent, removed, or detached. On 4/11/2009 7:46 AM, rpalache wrote: Hi, Set the cascade attribute for this field to CascadeType.PERSIST or CascadeType.ALL (JPA annotations) or persist or all (JPA

OneToMany update issue

2009-04-11 Thread Stefan Zeller
Hello all, I've got a problem with the update of a manyToOne field which is mapped by another entity. I searched and tried out for the last week and I didn't had success, so I ask here. BTW, I'm new to JPA so maybe it's a conceptual problem. My test case is fairly simple. I've got to

Re: OneToMany update issue

2009-04-11 Thread Paul Copeland
Hi Stefan - I think your A.SetB(B) method must call B.add(A) From section 2.1.7 in JPA Specification - Note that it is the application that bears responsibility for maintaining the consistency of runtime relationships---for example, for insuring that the one and the many sides of a

Re: persistence problem in distributed environment

2009-04-11 Thread rpalache
Hi Paul, Yes you are correct about unmanaged. Using cascadeAll on account and calling entityManager.persist(voucher) will make the account object also persistent. So, I am guessing my suggestion should work fine. Regards, Ravi. unmanaged means the Account object assigned to the ManyToOne

Re: persistence problem in distributed environment

2009-04-11 Thread rpalache
Hi Paul, Thanks for the clarification. I overlooked Account account = entityManager.find(Account.class, 215L); The above statement is supposed to return a proper entity object in return. I would assume the original code in problem description should work fine. I will try to run it against

Re: persistence problem in distributed environment

2009-04-11 Thread rpalache
Hi, I am unable to replicate the issue. The sample code you mentioned in problem description is working as expected on weblogic application server with oracle database (10.1.0.2) and oracle XA driver (Oracle JDBC Driver version - 10.1.0.2.0). Here is the configuration I used: