Actually I'm not sure and to be honest I don't think it's solved. 

But it's much easier if we have a sample for 2.4.1 than for an old version.
I'd like to work on this in the mainstream version. 

If the fix is easy then we might think about backporting if necessary.
If we get a sample then it might get fixed with the next mainstream release 
(2.4.2)

LieGrue,
strub





> On Monday, 4 April 2016, 9:40, Datin Benoit 
> <benoit.da...@thomson-networks.com> wrote:
> > Hi all,
> 
> Do you mean this bug is resolved in 2.4.1 ?
> In 2014, I have been faced with a similar problem as the one described below 
> and 
> the OPENJPA-1936
> 
> https://issues.apache.org/jira/browse/OPENJPA-1936
> 
> 
> 
> -----Original Message-----
> From: Mark Struberg [mailto:strub...@yahoo.de.INVALID] 
> Sent: dimanche 3 avril 2016 12:56
> To: users@openjpa.apache.org
> Subject: Re: Wrong order for delete of child when deleting parent
> 
> Can you please try upgrading to 2.4.1?
> If you get the same issue in the newest version then it's much easier for us 
> to reproduce.
> 
> 
> It would also help if you could provide a sample project which at least 
> contains 
> the entity constellation in question. It's much easier to discuss about such 
> things in code than in mail ;)
> 
> txs and LieGrue,
> strub
> 
> 
>>  Am 30.03.2016 um 19:33 schrieb tvogel <tvo...@msn.com>:
>> 
>>  The order of deletes for OpenJPA 2.3.x are happening in the wrong 
>>  order and I can't figure out why.
>> 
>>  Given these JPA mappings
>> 
>>     // grandparent
>>     @Entity
>>     @Table(name = "three_phase_motor_input")
>>     public class ThreePhaseMotorInput implements IThreePhaseMotorInput, 
>>  Serializable {
>>         @Id
>>         @GeneratedValue(strategy = GenerationType.IDENTITY)
>>         private Long id;
>>         @Version
>>         private Integer version;
>> 
>>         @OneToOne(orphanRemoval = true, cascade = CascadeType.ALL, 
>>  optional = true, targetEntity = UnapprovedThreePhaseMotor.class)
>>         @JoinColumn(name = "unapproved_id")
>>         private IThreePhaseMotor unapprovedMotor;
>> 
>>     // parent
>>     @Entity
>>     @Table(name = "unapproved_three_phase_motor")
>>     public class UnapprovedThreePhaseMotor extends ThreePhaseMotor {
>>         @OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, 
>>  fetch = FetchType.LAZY, targetEntity = UnapprovedThreePhaseWire.class)
>>         @JoinColumn(name = "motor_id", referencedColumnName = 
> "id", 
>>  nullable =
>>  false)
>>         @OrderColumn(name = "idx")
>>         private List<IThreePhaseWire> wires;
>> 
>> 
>>     // child - Abstract
>>     @MappedSuperclass
>>     @Access(AccessType.FIELD)
>>     public abstract class ThreePhaseWire implements IThreePhaseWire, 
>>  Serializable {
>>         @Id
>>         @GeneratedValue(strategy = GenerationType.IDENTITY)
>>         private Long id;
>> 
>>     // child concrete
>>     @Entity
>>     @Table(name = "unapproved_three_phase_wire")
>>     public class UnapprovedThreePhaseWire extends ThreePhaseWire {
>> 
>> 
>>  Order of SQL statements in log file when setting unapprovedMotor in 
>>  grandparent to null
>> 
>>      572353115 UPDATE three_phase_motor_input SET status = ?, version = 
>>  ?, approved_id = ?, unapproved_id = ? WHERE id = ? AND version = ?
>>  [params=(int) 1, (int) 8, (null) null, (null) null, (long) 896, (int) 7]
>>      1683522521 DELETE FROM unapproved_three_phase_motor WHERE id = ? 
>>  AND version = ? [params=(long) 209938, (int) 1]
>>      446470297 DELETE FROM unapproved_three_phase_wire WHERE id = ?
>>  [params=(long) 1394]
>> 
>>  This causes a foreign key constraint error since the child still 
>>  exists when the parent delete statement is executed.
>>     
>> 
>> 
>> 
>>  --
>>  View this message in context: 
>>  http://openjpa.208410.n2.nabble.com/Wrong-order-for-delete-of-child-wh
>>  en-deleting-parent-tp7589053.html Sent from the OpenJPA Users mailing 
>>  list archive at Nabble.com.
> 

Reply via email to