• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setRollbackOnly() doesn't work

 
ravinderSingh singh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your DD look like?
 
Sanjeev Verma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ... ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic