I have two entities ENTA
having one-many relationship with ENTB
.
I am trying to update two records in java. The order of updates that is happening is :
update ENTA set column_name=? where id=ENTA1;
update ENTB set column_name=? where id=ENTB1;
update ENTB set column_name=? where id=ENTB2;
update ENTA set column_name=? where id=ENTA2;
My problem is on update of ENTB
, we have a Database trigger which calculates the value for one of the column of ENTA
table.
Hence for the first record, the update happens correctly. However for the second record, the update by the trigger is overridden since the order of updates has changed for the second records as seen above.
I tried to do dynamic-update="true"
for ENTA
table, however some other areas in my application are not working as per expected.
I have even tried for order_updates
property of hibernate, however no success!
Could you please let me know any other way to tell hibernate to update it in a particular order?