You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by "josh.wilson" <jo...@inspiredbyte.com> on 2013/06/18 19:19:00 UTC

OneToMany Delete Order Problem

I have a unidirectional one to many relationship defined but I am getting a
foreign key constraint violation when attempting to run a delete on the
entity.  It appears the delete statements are not being issued in the
correct order.  The entity record is being deleted before the records with
the foreign key references.  

Is there any way to get them ordered properly?  Configuration details
follow..

OpenJPA 2.2.1-SNAPSHOT (Websphere Version)

Annotations on entity field

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval
= true)
@JoinColumn(name = "ID_XXX", referencedColumnName = "ID_XXX", nullable =
false)







--
View this message in context: http://openjpa.208410.n2.nabble.com/OneToMany-Delete-Order-Problem-tp7584211.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

RE: OneToMany Delete Order Problem

Posted by Boblitz John <jo...@bertschi.com>.
Good Morning,

could this issue somehow be related to https://issues.apache.org/jira/browse/OPENJPA-2211?

Just an idea ...

John

> -----Original Message-----
> From: josh.wilson [mailto:josh.wilson@inspiredbyte.com]
> Sent: Monday, June 24, 2013 8:43 PM
> To: users@openjpa.apache.org
> Subject: Re: OneToMany Delete Order Problem
> 
> I tried adding the SchemaFactory property to the persistence.xml but it did not
> correct the statement order.  Any other ideas?
> 
> 
> On Thu, Jun 20, 2013 at 2:59 AM, Jens Leisenberg [via OpenJPA] <
> ml-node+s208410n7584221h73@n2.nabble.com> wrote:
> 
> > Josh,
> >
> > did you tried to set the ShemaFactory property in your persistence.xml
> > to 'native(ForeignKeys=true)'? This should reorder the statements.
> >
> >
> > http://ci.apache.org/projects/openjpa/2.1.x/manual/ref_guide_schema_in
> > fo.html#ref_guide_schema_info_factory
> >
> >
> >
> > From: "josh.wilson" <[hidden
> > email]<http://user/SendEmail.jtp?type=node&node=7584221&i=0>>
> >
> > To: [hidden email]
> > <http://user/SendEmail.jtp?type=node&node=7584221&i=1>,
> >
> > Date: 06/18/2013 07:19 PM
> > Subject: OneToMany Delete Order Problem
> >
> >
> >
> > I have a unidirectional one to many relationship defined but I am
> > getting a foreign key constraint violation when attempting to run a
> > delete on the entity.  It appears the delete statements are not being
> > issued in the correct order.  The entity record is being deleted
> > before the records with the foreign key references.
> >
> > Is there any way to get them ordered properly?  Configuration details
> > follow..
> >
> > OpenJPA 2.2.1-SNAPSHOT (Websphere Version)
> >
> > Annotations on entity field
> >
> > @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER,
> > orphanRemoval = true) @JoinColumn(name = "ID_XXX",
> > referencedColumnName = "ID_XXX", nullable =
> > false)
> >
> >
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> > http://openjpa.208410.n2.nabble.com/OneToMany-Delete-Order-Problem-
> tp7
> > 584211.html
> >
> > Sent from the OpenJPA Users mailing list archive at Nabble.com.
> >
> >
> >
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the
> > discussion
> > below:
> >
> > http://openjpa.208410.n2.nabble.com/OneToMany-Delete-Order-Problem-
> tp7
> > 584211p7584221.html  To unsubscribe from OneToMany Delete Order
> > Problem, click
> > here<http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macr
> >
> o=unsubscribe_by_code&node=7584211&code=am9zaC53aWxzb25AaW5zcGly
> ZWRieX
> > RlLmNvbXw3NTg0MjExfDk4NjE4NjU2Mw==>
> > .
> > NAML<http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macr
> >
> o=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.na
> ml.
> > namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nab
> >
> ble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21
> n
> > abble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-
> send_instant_e
> > mail%21nabble%3Aemail.naml>
> >
> 
> 
> 
> 
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/OneToMany-Delete-Order-Problem-
> tp7584211p7584249.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: OneToMany Delete Order Problem

Posted by "josh.wilson" <jo...@inspiredbyte.com>.
I tried adding the SchemaFactory property to the persistence.xml but it did
not correct the statement order.  Any other ideas?


On Thu, Jun 20, 2013 at 2:59 AM, Jens Leisenberg [via OpenJPA] <
ml-node+s208410n7584221h73@n2.nabble.com> wrote:

> Josh,
>
> did you tried to set the ShemaFactory property in your persistence.xml to
> 'native(ForeignKeys=true)'? This should reorder the statements.
>
>
> http://ci.apache.org/projects/openjpa/2.1.x/manual/ref_guide_schema_info.html#ref_guide_schema_info_factory
>
>
>
> From: "josh.wilson" <[hidden email]<http://user/SendEmail.jtp?type=node&node=7584221&i=0>>
>
> To: [hidden email] <http://user/SendEmail.jtp?type=node&node=7584221&i=1>,
>
> Date: 06/18/2013 07:19 PM
> Subject: OneToMany Delete Order Problem
>
>
>
> I have a unidirectional one to many relationship defined but I am getting
> a
> foreign key constraint violation when attempting to run a delete on the
> entity.  It appears the delete statements are not being issued in the
> correct order.  The entity record is being deleted before the records with
> the foreign key references.
>
> Is there any way to get them ordered properly?  Configuration details
> follow..
>
> OpenJPA 2.2.1-SNAPSHOT (Websphere Version)
>
> Annotations on entity field
>
> @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER,
> orphanRemoval
> = true)
> @JoinColumn(name = "ID_XXX", referencedColumnName = "ID_XXX", nullable =
> false)
>
>
>
>
>
>
>
> --
> View this message in context:
>
> http://openjpa.208410.n2.nabble.com/OneToMany-Delete-Order-Problem-tp7584211.html
>
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://openjpa.208410.n2.nabble.com/OneToMany-Delete-Order-Problem-tp7584211p7584221.html
>  To unsubscribe from OneToMany Delete Order Problem, click here<http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7584211&code=am9zaC53aWxzb25AaW5zcGlyZWRieXRlLmNvbXw3NTg0MjExfDk4NjE4NjU2Mw==>
> .
> NAML<http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://openjpa.208410.n2.nabble.com/OneToMany-Delete-Order-Problem-tp7584211p7584249.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: OneToMany Delete Order Problem

Posted by Jens Leisenberg <je...@de.ibm.com>.
Josh,

did you tried to set the ShemaFactory property in your persistence.xml to
'native(ForeignKeys=true)'? This should reorder the statements.

http://ci.apache.org/projects/openjpa/2.1.x/manual/ref_guide_schema_info.html#ref_guide_schema_info_factory



From:	"josh.wilson" <jo...@inspiredbyte.com>
To:	users@openjpa.apache.org,
Date:	06/18/2013 07:19 PM
Subject:	OneToMany Delete Order Problem



I have a unidirectional one to many relationship defined but I am getting a
foreign key constraint violation when attempting to run a delete on the
entity.  It appears the delete statements are not being issued in the
correct order.  The entity record is being deleted before the records with
the foreign key references.

Is there any way to get them ordered properly?  Configuration details
follow..

OpenJPA 2.2.1-SNAPSHOT (Websphere Version)

Annotations on entity field

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER,
orphanRemoval
= true)
@JoinColumn(name = "ID_XXX", referencedColumnName = "ID_XXX", nullable =
false)







--
View this message in context:
http://openjpa.208410.n2.nabble.com/OneToMany-Delete-Order-Problem-tp7584211.html

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