Java Mailing List Archive

http://www.gg3721.com/

Home » users.openjpa »

Incosistent Persist Operation

jpa_user

2008-07-22

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi

I have a class A which has 3 ManyToOne references. When I try to persist A
the insert queries fired are inconsistent.
As a result entire persist opertation fails

Class A
{
@ManyToOne(targetEntity="B.class",cascade=CascadeType.ALL)  
B b;
 @ManyToOne(targetEntity="C.class",cascade=CascadeType.ALL)  
C c;
 @ManyToOne(targetEntity="D.class",cascade=CascadeType.ALL)  
D d;
}

out of 3 references I would be setting b and c and leave d as null.
When I persist Object of A with b and c also as new instances the behaviour
of persist is inconsistent.

I have put postload methods in each of the B,C classes and printing the
auto-gererated hexadecimal UID. Every time the values of UID gets printed
but i dont see the corresponding query of insert into either B or C.
If inserts are fired for B and C then the transaction is properly complete.

I am unable to see any error in the log generated other than the insert
failure thrown by db due to foreign key violation( Though it doesnt insert
either b or c it would try to insert A which would fail).

Any thoughts of where could be the problem would be of great help.

regards,
Srinivas KLP
--
Sent from the OpenJPA Users mailing list archive at Nabble.com.

©2008 gg3721.com - Jax Systems, LLC, U.S.A.