Why don't all DB operations execute in the same order as they were called on EJB level?
Issue
We have two entity beans (EJB2):
PARENT
- pk_parentid: p1
CHILD
- pk_childid: c1
- fk_parentid: p1
There is a FK constraint on DB level, but not on EJB level.
Now we want to delete parent p1 but keep child c1. In one transaction, first
c1.setParentid(null); is called, and then
p1.remove();
Since we have sync-on-commit-only set to true, the changes are synchronized to DB not before the commit.
I would expect all DB operations to be executed in the same order as they were called on EJB level, but the DELETE statement is called first which results in a SQL Exception because of DB constraint violation. Is this a JBoss bug?
Environment
JBoss EAP
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.