-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Interceptor callback b4TransactionCompletion in CMT
PostPosted: Fri Apr 28, 2006 9:11 am 
Newbie

Joined: Tue Apr 25, 2006 4:33 am
Posts: 2
Hibernate version:
3.0.5 / 3.1.3

Configuration:
The hibernate configuration:

Code:
<property name="connection.datasource">java:comp/env/jdbc/POCTEST</property>
<property name="transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.WebSphereTransactionManagerLookup</property>
<property name="hibernate.transaction.flush_before_completion">true</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>


Name and version of the database:
MS SQL Server 2000

Code
I have a CMT session bean with following business method :

Code:
public void testHistory() {
   Configuration config = new Configuration();
   config.configure();
   factory = config.buildSessionFactory();
   s = factory.openSession(new TestInterceptor());
   Customer cust = (Customer)s.load(Customer.class, new Integer(1001));
   cust.setName("New Name");
   s.update(cust);
}


When this EJB method is called from a servlet, Customer object is updated successfully in DB. On this hibernate calls following interceptor callback methods (Note that I have not started/comitted the transaction explicitly nor closed the session):
Code:
onLoad()
preFlush()
onFlushDirty()
postFlush()
beforeTransactionCompletion()

The problem is, Transaction argument passed to the beforeTransactionCompletion() is null and hence I am not able to rollback the parent transaction if my code in this method fails.
The transaction is null even if I explicitly begin/commit the transaction on hibernate session.

Instead of EJB if I run the above method from a standalone application it works fine.

Any help on this is really appreciated.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.