> -----Ursprüngliche Nachricht----- > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Gesendet am: Dienstag, 1. August 2000 00:22 > An: Orion-Interest > Betreff: failed transaction problem - new entity bean not erased > > Hi everybody - Hi, i don't know, why it does not work, but some things about transaction handling i was able to figure out... > I've got a session bean that creates a new entity bean, pushes some > things around in the database, then [on purpose] throws an > EJBException to rollback the transaction. When I look at the database, > I see that all the stuff the session bean did to the database has been > [correctly] rolled back, but the entity bean that was created during > the transaction hasn't been removed from the database. Is this proper > behavior? Surely this is no proper behaviour if your transaction settings are right. > > The session bean is stateless and declared as doing bean managed > transactions. The session bean 'requires' a transation for all method > calls. The UserTransaction.begin() method is called before creating > the entity bean. The entity bean does BMP, declares itself as > Container managed transactions, and 'supports' transactions. Did you try the same with a transaction setting of required for the entity bean? However, as far as i understand, it should work with "supports" (see the spec). Which datasource are you using for your BMP? The ejb-location? > > I've been able to retrieve one of these entity beans, modify it's > contents, then rollback the transaction and that works perfectly. > > I threw in some debugging statements, and the 'ejbRemove' method is > never called for the entity bean - shouldn't it do that after the > transaction is rolled back? I'm actually surprised it wasn't rolled > back, because I'm using the DefaultEJBDS. Should I be creating a > UserTransaction object for the entity bean and wrapping all operations > within begin() and end() calls? As far is i understood, the ejbRemove will never be called on a rollback. The cleanup after a failed transaction seems to be the responsibility of the databases transaction system (if not, it would work with non-transactional databases like mySQL, too). So, no user code will be executed to perform a rollback. Hope that helps to find out more... Jens Stutte