Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Order of operations in EclipseLink

Hi Patric,

AFAIK it is an intentional behaviour, EL just like any other JPA/JDO implementation that we've used (EL, OpenJPA, etc) do inserts before deletes.
I don't remember the reason. I just remember there was one. Maybe someone else can explain that to us.
To keep the AK you can either flush right after the delete or replace the delete/insert by an update.

-Michael

-----Ursprüngliche Nachricht-----
Von: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] Im Auftrag von patric@xxxxxxxxxxx
Gesendet: Mittwoch, 29. Dezember 2010 14:27
An: EclipseLink-users@xxxxxxxxxxx
Betreff: [eclipselink-users] Order of operations in EclipseLink

Hi,

imagine a simple table/entity TestTable with an AK on column status.

The following operations will fail using EclipseLink:

TestTable tt = new TestTable();
tt.setStatus("BLA");
em.persist(tt);
em.flush();

em.remove(tt);

TestTable tt2 = new TestTable();
tt2.setStatus("BLA");
em.persist(tt2);
em.flush(); //this will throw an exception due to AK violation


However, I would expect a successfull run because I previously removed  
the record which has the same AK.

It seems that the operation order is modified by EclipseLink -
inserts seems to be executed first which might change the outcome of a  
set of operations.
Is this an intentional behaviour?
If it is, is there a possibility to preserve the operation order?

Thank you and best regards,
Patric


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top