Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.0.3
I have gone through the document and also gone through the posts where couple of people have indicated the same problem. I did go through the "Sessions and Transactions" document and made the hibernate settings as follows:
<?xml version="1.0"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory name="sessionFactory">
<!-- ******************************************************************************* -->
<!-- uncomment this section to use the data source services as defined by WebSphere -->
<!-- ******************************************************************************* -->
<!-- -->
<property name="connection.datasource">jdbc/datasrc</property>
<property name="connection.autocommit">true</property>
<property name="current_session_context_class">thread</property>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.WebSphereTransactionManagerLookup</property>
<property name="default_schema">BEFG</property>
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<!-- ******************************************************************************* -->
<!-- JNDI properties -->
<!-- ******************************************************************************* -->
<!-- uncomment this section for local usage -->
<property name="jndi.url">IIOP://localhost:14005/</property>
<property name="jndi.class">com.ibm.websphere.naming.WsnInitialContextFactory</property>
<!-- ******************************************************************************* -->
<!-- Miscellaneous properties -->
<!-- ******************************************************************************* -->
<property name="show_sql">true</property>
<property name="use_outer_join">true</property>
<property name="query.imports">org.hibernate.test, org.hibernate.eg</property>
<property name="jdbc.use_streams_for_binary">true</property>
<property name="jdbc.batch_size">0</property>
<!-- mapping files -->
<mapping resource="jdos/File1.hbm.xml"/>
</session-factory>
</hibernate-configuration>
However, when I use a datasource to the UDB database from WebSphere and execute the code, the update is failing with the error transaction.JDBCTransaction.toggleAutoCommit - Could not toggle autocommit
java.sql.SQLException: DSRA9350E: Operation setAutoCommit is not allowed during a global transaction. Stack trace is as follows:
Do we have any solution?
Full stack trace of any exception that occurs:
10/19/06 16:03:13 DEBUG def.DefaultSaveOrUpdateEventListener.entityIsTransient - saving transient instance
10/19/06 16:03:13 DEBUG def.AbstractSaveEventListener.saveWithGeneratedId - generated identifier: 4ceaf1bf7549db76:4c1a442c:10e62cde11a:-7ff7, using strategy: org.hibernate.id.Assigned
10/19/06 16:03:13 DEBUG def.AbstractSaveEventListener.performSave - saving [com.usbank.leasing.portal.data.jdo.PortalSession#4ceaf1bf7549db76:4c1a442c:10e62cde11a:-7ff7]
10/19/06 16:03:13 DEBUG transaction.JDBCTransaction.commit - commit
10/19/06 16:03:13 DEBUG transaction.JDBCTransaction.toggleAutoCommit - re-enabling autocommit
10/19/06 16:03:13 ERROR transaction.JDBCTransaction.toggleAutoCommit - Could not toggle autocommit
java.sql.SQLException: DSRA9350E: Operation setAutoCommit is not allowed during a global transaction.
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.setAutoCommit(WSJdbcConnection.java:2009)
at org.hibernate.transaction.JDBCTransaction.toggleAutoCommit(JDBCTransaction.java:174)
at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:122)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:95)
Name and version of the database you are using: DB2/UDB 8.2