This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes CMP and JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "CMP and JDBC" Watch "CMP and JDBC" New topic
Author

CMP and JDBC

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
I have inherited code where I have a bean (stateless session) where all it's remote methods use container managed transactions. Inside some of these methods JDBC is used directly, with auto-commit turned on(assuming thats the default in weblogic 10.x).
Further ,there are explicit connection.commit at some places - and a connection.preparestament('begin transaction')/('end transaction') execution at others.

Do these JDBC statements subvert the CMP configuration?
What do I need to ensure if I am reviewing this code in terms of sanity?

(I am assuming that in case of BMP - the JDBC connection settings hold supreme anyways.)
Claude Moore
Ranch Hand

Joined: Jun 24, 2005
Posts: 428
    
    1

It seems very strange to mix up container managed transactions and autocommit. Moreover, I would expect that a call to commit() or rollback() method on a connection object inside a method with CMT would make the container complain about it throwing some exceptions (like "illegal state exception"), so If I were you I would try to review the code avoiding manual tx handling in a CMT context.
 
Don't get me started about those stupid light bulbs.
 
subject: CMP and JDBC
 
Similar Threads
Mixing JDBC and CMP code -> leaked connections
JDBC connection and transactions
BMP and Data Source Mapping in WSAD 5.0?
Logging Database Connectivity Errors
Stateless EJB and transactions