0 Replies Latest reply: Feb 23, 2012 10:35 AM by fpezzati RSS

force a commit in EJB3

fpezzati Newbie

Hello everybody,


I'm working with JBoss5 and Oracle11g. I do a couple of inserts and a select inside a stateless bean's method. More precisely:


-insert into A values (...);

-select * from A where ...;

-insert into B values (...).


The first insert succeed, the second fails because of a ConstraintViolationException. That's because the second insert took some value from the select, one of those fields is a foreing key (refers to table A). How do I avoid this problem? Does anybody know how to force a commit inside a Stateless bean's method? Is commit the solution? TIA.