Title: should a transaction rollback if CreateException is thrown by jboss? was: [JBoss-user] Rollback Transaction

  Then there's a bug in jboss (I use 3.0.4) because when CreateException is being thrown by a CONTAINER (not bean) during ejbCreate(), transaction is not rolled back. Practical example: I set a CMR fiend in ejbCreate() which is not allowed. Container throws CreateException but the row in database is there and transaction is not rolled back (because container forgot to setRollbackOnly())!

  The only workaround here is to design all ejbCreate methods like:

public String ejbCreate(...) {
  try {
//   ...
  } catch (CreateException e)
    ctx.setRollbackOnly();
    throw e;
  }
}
But I think it is quite not a good idea.

-----Original Message-----
From: Ivan Bolcina [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 10:44
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] Rollback Transaction


CreateException is "application" exception. They don't rollback transactions. You have to setRollbackOnly() on context.

Container rolls back transaction only in case of EJBException. (not CreateException, strange, but maybe programer wants to throw CreateException and dont want to roll back the rest of transaction)

-----Original Message-----
From: bryan hansen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 12:03 AM
To: [EMAIL PROTECTED]
Subject: [JBoss-user] Rollback Transaction
I am using JBoss 3.0.5RC1 on W2K box against a
SQLServer 2000 database. I am calling two entities
beans from a stateless session bean. The second
entities throughs a CreateException. I was under the
impression that since the method of a stateless
session bean was held for the duration the transaction
that the write from the first entity bean would have
been rolled back as well as the write from the second
entity bean. Neither was rolled back (I forced the
exception for a test of the transactioning).
I am missing something with the transaction engine or
how this should function in general? I thought that if
an exception was thrown it would rollback all
transactions involved with that stateless session bean
method? Or do I have something configured incorrectly
with my JDBC datasource(SQLServer)? Should it be an
XADatasource instead of a regular datasource?
TIA,
Bryan
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


-------------------------------------------------------
This SF.NET email is sponsored by: A Thawte Code Signing Certificate
is essential in establishing user confidence by providing assurance of
authenticity and code integrity. Download our Free Code Signing guide:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0028en
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to