Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

CMT does not rollback Tx in hibernate  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please let me know whats wrong with my settings. CMT doesnot rollback hibernate Tx.

I'm using hibernate 3.0 , weblogic 9.2, EJB 2.x, Oracle9i. I'm trying to implement a transaction rollback mechanism in a project. But the transaction does not rollback. Here are my configurations:

<property name="transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.WeblogicTransactionManagerLookup</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="show_sql">false</property>
<property name="jdbc.batch_size">30</property>
<property name="hibernate.jdbc.batch_versioned_data">true</property>
<!-- new addition -->
<property name ="jndi.class">weblogic.jndi.WLInitialContextFactory</property>
<property name="current_session_context_class">thread</property>

SLB1 is the business interface which has business methods with "Required" as transaction attribute.
Business delegate is also a SLB with Tx attribute as "Required".

Business delegate invokes the corresponding some other business interface's business method.

POJO does the CRUD operations with hibernate API's

frontend() -> BusinessDelegate().delegate() -> SLB1.execute() -> POJO.updateDB()

Pojo.update(Object obj)
try {
// open session
// session.saveorUpdate(obj);
// session.flush();
} catch (HibernateException e) {
// log exception
throw e;
} finally {

try {
// call some local business method m1 - "select query"
// call PoJo.update(obj);
String a = null;

// call some local business method m2 - "select query"
} Catch(Exception e) {
// log exception
// throw exception to business delegate

Business delegate.delegate()
try {
// call corresponding SLB1.execute() method
catch(Application exception) {
// throw exception to front end

I tried to test the rollback mechanism. Added a breakpoint using eclipse after the update method call in SLB1.execute method. After the update call, i have added a code which throws NullPointerException. Then when i checking the database, the object is modified.

Don't know what i'm missing. Can you please help me in fixing this issue ?

Thanks in advance
Scott Selikoff
Posts: 4087
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Welcome to the JavaRanch. We don't have many rules here but one in particular that we follow is it regards to permitted names. Please review The JavaRanch Naming Policy and updated your name accordingly.

Scott Selikoff, JavaRanch Bartender
[ September 30, 2008: Message edited by: Scott Selikoff ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!