openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Boblitz John <john.bobl...@bertschi.com>
Subject RE: Wrong order for delete of child when deleting parent
Date Thu, 31 Mar 2016 14:13:02 GMT
Hello Tim,

My "Non expert" opinion is that your entities look okay, although to be sure, you would need
to add Unique Constraints to them.  

According to "The Book", that is supposed to work:

13.2. Unique Constraints
...
"The unique constraints you define are used during table
creation to generate the proper database constraints, and may also be used at runtime to order
INSERT, UPDATE , and DELETE
statements. For example, suppose there is a unique constraint on the columns of field F. In
the same transaction, you remove an
object A and persist a new object B, both with the same F value. The JPA runtime must ensure
that the SQL deleting A is sent to
the database before the SQL inserting B to avoid a unique constraint violation."

Unfortunately, that failed for me when I tried it - which is the reason for the Jira link
posted earlier.  There is apparently a Bug in the code ....


See this for the discussion that led to the Jira:  http://openjpa.208410.n2.nabble.com/Order-of-SQL-Statements-td7580252.html

Cheers

John

PS - if you find a solution, please share!


> -----Original Message-----
> From: tvogel [mailto:tvogel@msn.com]
> Sent: Donnerstag, 31. März 2016 13:51
> To: users@openjpa.apache.org
> Subject: RE: Wrong order for delete of child when deleting parent
> 
> John,
>   Thanks for taking the time to read, reply and for the issue link.
> 
>   I switched from a @MappedSuperclass to @Entity with
> @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS).  The issue is
> still present.
> 
>   Do my mappings look correct for a uni-directional one-to-one mapping
> owned by the many side (for motor to wire)?
> 
> Tim
> 
> 
> 
> --
> View this message in context: http://openjpa.208410.n2.nabble.com/Wrong-
> order-for-delete-of-child-when-deleting-parent-tp7589053p7589056.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message