Topic
  • 2 replies
  • Latest Post - ‏2011-12-09T02:21:51Z by Forrest_Xia
Harry2000
Harry2000
1 Post

Pinned topic Can't insert a row eventhough 'The active transaction was committed.

‏2011-11-14T20:23:31Z |
I am using the following configuration for the hibernate.

<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.datasource">java:comp/env/jdbc/datawhse</property>
<property name="hibernate.session_factory_name">jdbc/datawhse</property>
<property name="hibernate.dialect">org.hibernate.dialect.DB2400Dialect</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.format_sql">false</property>
<property name="hibernate.use_sql_comments">false</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="hibernate.connection.autocommit">false</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.cache.use_second_level_cache">false</property>
<property name="hibernate.cache.use_query_cache">false</property>
</session-factory>
</hibernate-configuration>

<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.datasource">java:comp/env/jdbc/datawhse</property>
<property name="hibernate.session_factory_name">jdbc/datawhse</property>
<property name="hibernate.dialect">org.hibernate.dialect.DB2400Dialect</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.format_sql">false</property>
<property name="hibernate.use_sql_comments">false</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="hibernate.connection.autocommit">false</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.cache.use_second_level_cache">false</property>
<property name="hibernate.cache.use_query_cache">false</property>
</session-factory>
</hibernate-configuration>

I have the following java code.
session = HibernateUtils.getSession("datawhse");
tx = session.beginTransaction();
Set<DealerOrderDetail> doDetailSet = doHeader.getOrderDetails();
Iterator<DealerOrderDetail> iterator = doDetailSet.iterator();
session.save(doHeader);
tx.commit();
if(!tx.wasCommitted())
System.out.println("Transaction was not committed:");

In the logs, the message says that 'The active transaction was committed',but, when i check the database, the row is not there. tx.wasCommitted() is also coming out as true.

please help. i am stuck on this for a while.
Updated on 2011-12-09T02:21:51Z at 2011-12-09T02:21:51Z by Forrest_Xia
  • Shawn_Jiang
    Shawn_Jiang
    154 Posts

    Re: Can't insert a row eventhough 'The active transaction was committed.

    ‏2011-12-06T10:12:58Z  
    Before we can give you further suggestions, could you tell us more information ?

    1, What's the version of WASCE you are using ?
    2, What's the hiberate version you are using ?
    3, What's the your application structure ?
  • Forrest_Xia
    Forrest_Xia
    82 Posts

    Re: Can't insert a row eventhough 'The active transaction was committed.

    ‏2011-12-09T02:21:51Z  
    Before we can give you further suggestions, could you tell us more information ?

    1, What's the version of WASCE you are using ?
    2, What's the hiberate version you are using ?
    3, What's the your application structure ?
    It's better to have a ready simple sample with this problem, so that we can investigate this problem easily and more responsively.

    Thanks!
    Forrest