aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes setRollbackOnly() doesn't work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "setRollbackOnly() doesn Watch "setRollbackOnly() doesn New topic
Author

setRollbackOnly() doesn't work

ravinderSingh singh
Ranch Hand

Joined: Nov 18, 2004
Posts: 41
Hi all,

I'm using an Oracle database and Weblogic server. However, when I execute the following code (which is contained within an ejb session bean method):



... the insert statement is not rolled back even though I explicitly call setRollbackOnly().

Could anyone help?
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
What does your DD look like?


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Sanjeev Verma
Ranch Hand

Joined: Aug 24, 2000
Posts: 87
Sun says - "Only enterprise beans with container-managed transactions are allowed to use this method." - is your bean marked as container-managed?
ravinderSingh singh
Ranch Hand

Joined: Nov 18, 2004
Posts: 41
I'm using container managed transactions.

The DD entry is as follows:

<session>
<ejb-name>Bean</ejb-name>
<home>MyBeanHome</home>
<remote>MyBeanEJB</remote>
<ejb-class>MyBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<res-ref-name>jdbc/DataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
...
<container-transaction>
<method>
<ejb-name>Bean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>

Any suggestions ... ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setRollbackOnly() doesn't work