File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "CMP and JDBC" Watch "CMP and JDBC" New topic


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: 720

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.
I agree. Here's the link:
subject: CMP and JDBC
It's not a secret anymore!