Hi all ,
Need urgent help in fixing an issue.
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:
hibernate.cfg.xml
---------------------
<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>
.............
Flow
------
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 {
closeSession();
}
SLB1.execute()
-------------------
try {
// call some local business method m1 - "select query"
// call PoJo.update(obj);
Breakpoint >>>>>> // 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) {
sessionctx.setRollbackOnly();
// 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. On reaching the breakpoint, i made the application server down (shutdown). 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
|