Hi,
1. how do class B,C,D declare its relation to A, if at all?
2. if the relations are bi-directional, are the both sides of relation set
consistently?
3. how the identity fields are declared?
4. please post any SQL log by configuring
<property name="openjpa.Log" value="SQL=TRACE"/>
5. OpenJPA allows you to configure in which order the generated SQLs are
executed via
openjpa.jdbc.UpdateManager property. Have you observed any change in
behavior in terms of different update strategies?
6. have you instructed OpenJPA to read foreign key information from
existing database schema
<property name="openjpa.jdbc.SchemaFactory"
value="native(ForeignKeys=true)"/>
jpa_user wrote:
>
> 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
>
--
View this message in context:
http://n2.nabble.com/Incosistent-Persist-Operation-tp576518p576586.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.