Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within EJB and other Jakarta /Java EE Technologies
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Tim Cooke
Devaka Cooray
Sheriffs:
Liutauras Vilda
paul wheaton
Rob Spoor
Saloon Keepers:
Tim Moores
Stephan van Hulst
Tim Holloway
Piet Souris
Mikalai Zaikin
Bartenders:
Carey Brown
Roland Mueller
Forum:
EJB and other Jakarta /Java EE Technologies
setRollbackOnly() doesn't work
ravinderSingh singh
Ranch Hand
Posts: 41
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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):
// Lookup datasource Context ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup(DATASOURCE); connection = ds.getConnection(); // Insert some data connection.createStatement().executeUpdate("some insert statement"); // Rollback the insert statement sessionContext.setRollbackOnly()
... the insert statement is not rolled back even though I explicitly call setRollbackOnly().
Could anyone help?
Roger Chung-Wee
Ranch Hand
Posts: 1683
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
What does your DD look like?
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Sanjeev Verma
Ranch Hand
Posts: 87
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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 ... ?
Attractive, successful people love this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Transcation management at DO level using spring jdbc framework
can we use tx in servlets ?
Problem in Two-phase Commit
Facing Issue while spring transaction roll back.
Connection from DataSource only allows "selects"!
More...