Search code examples
javajpaeclipselink

entity manager unstable behaviour


i have a one to many relation ship between account and accountCode class with cascade all cascade type. when i delete account sometime the account and all its account code is deleted and sometime an exception occur state that "The DELETE statement conflicted with the REFERENCE constraint (ACCOUNTCODE_accountId) ". the second case usually occur when i add(persist) a new account code then try to delete the account. i am using eclipse link with sql server and i can provide the classes and the facade if this explanation is not sufficient.


Solution

  • Could you try @PrivateOwned?

    ref: http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_privateowned.htm