I am using a SessionBean as a Facade to my EntiyBeans!
Well, in one of my SessionBeans I have implemented a method which creates
some EntityBeans. Thats all ok, however after that creation I also call some
additional set-methods on these creates EntityBeans. If one of these method
calls fails an exception is thrown and the transaction is rollbacked.
Howerever, the created EntityBeans in that transaction context are still
available that means the corresponding entries in my database are still
there and were not rollbacked.
Is that behavior correct or do I do anything wrong, so that I have to remove
all created EntityBeans on myself in the catch-clause of my try-catch
Two possible causes for this behavior might be:
1. using transaction attribute Supports on the session bean and Required on entity. Then each call to entity method is in its own transaction.
2. If you are using version of mysql w/o transactions...