Hibernate version:2.1.6
Code between sessionFactory.openSession() and session.close():
//JOTM JTA Transaction already started....
MyObj obj;
Session ses;//actually doing my session getting here.
net.sf.hibernate.Transaction tx = ses.beginTransaction();
if( obj.getId() == null ) {//if the Long is Null then we need to save.
obj.setId((Long)ses.save(obj));
}
else {
ses.update(obj);
}
tx.commit();
//Session closing handled by a filter.
//JOTM JTA commit call handled by an outside class.
Full stack trace of any exception that occurs: No Exception Occurs
Name and version of the database you are using: Oracle 9.2
The generated SQL (show_sql=true): Hibernate: select status_item_id_seq.nextval from dual Hibernate: insert into status_item (description, item_number, message, packing_list, po_number, quantity, submit_time, user_id, retryable, viewable, status_state, building_id, dock_date, receiver_number, retried_status_item, status_item_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
This is the jist of my code. What's happening, is that the inserts or updates don't get persisted to the database. I've stepped into JOTM's code, and it looks like it's doing it's commit stuff. I registered an object that implements javax.transaction.Synchronization and it's getting all the call backs it should when the transaction commits.
I've also checked the connection class that hibernate is geting from the JOTM DataSource and it's org.enhydra.jdbc.standard.StandardXAConnectionHandle, which I assume is what you get when JOTM is managing your connections. So I'm presently at a loss. Anyone have any ideas?
|