Hibernate version:
3.0
Mapping documents:
<?xml version="1.0" ?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class name="test.UserObject" table="USEROBJECT">
<id name="id" column="ID" type="long">
<generator class="native" />
</id>
<property name="name" column="NAME" type="string" />
</class>
</hibernate-mapping>
Hibernate Configuration
<?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>
<session-factory>
<property name="connection.username">prhodes</property>
<property name="connection.password">redacted</property>
<property name="connection.url">jdbc:db2://localhost:50000/HIBTEST</property>
<property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.JOTMTransactionManagerLookup</property>
<property name="current_session_context_class">jta</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<mapping resource="test/UserObject.hbm.xml" />
</session-factory>
</hibernate-configuration>
Name and version of the database you are using:
DB/2 8.1.0
logging excerpt:
23:53:36,984 INFO [Environment] Hibernate 3.0.5
23:53:36,984 INFO [Environment] hibernate.properties not found
23:53:36,984 INFO [Environment] using CGLIB reflection optimizer
23:53:37,000 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
23:53:37,093 WARN [TestDriver] Welcome to TRANSACT!
23:53:37,109 INFO [jotm] JOTM started with a local transaction factory which is not bound.
23:53:37,109 INFO [jotm] CAROL initialization
23:53:37,125 DEBUG [ConfigurationRepository] Return empty properties, URL is null
23:53:37,125 DEBUG [ConfigurationRepository] Build protocol object for protocol name found 'cmi'.
23:53:37,140 DEBUG [ConfigurationRepository] Cmi is not available, don't configure it.
23:53:37,140 DEBUG [ConfigurationRepository] Build protocol object for protocol name found 'jeremie'.
23:53:37,140 DEBUG [ConfigurationRepository] Build protocol object for protocol name found 'iiop'.
23:53:37,140 DEBUG [ConfigurationRepository] Build protocol object for protocol name found 'jrmp'.
23:53:37,140 INFO [ConfigurationRepository] No protocols were defined for property 'carol.protocols', trying with default protocol = 'jrmp'.
23:53:37,375 DEBUG [jotm] default constructor
23:53:37,406 INFO [jta] JOTM 2.0.10
23:53:37,406 DEBUG [jta] TransactionFactory=org.objectweb.jotm.TransactionFactoryImpl@110003
23:53:37,406 DEBUG [jta] Batch constructor
23:53:37,406 DEBUG [jta] Clock constructor
23:53:37,421 DEBUG [recovery] TransactionRecoveryImpl constructor
23:53:37,421 DEBUG [recovery] JOTM Recovery is disabled
23:53:37,421 DEBUG [jotm] UserTransaction=org.objectweb.jotm.Current@290fbc
23:53:37,468 INFO [Configuration] configuring from file: hibernate.cfg.xml
23:53:37,578 DEBUG [DTDEntityResolver] trying to locate
http://hibernate.sourceforge.net/hibern ... on-3.0.dtd in classpath under org/hibernate/
23:53:37,578 DEBUG [DTDEntityResolver] found
http://hibernate.sourceforge.net/hibern ... on-3.0.dtd in classpath
23:53:37,625 DEBUG [Configuration] connection.username=prhodes
23:53:37,625 DEBUG [Configuration] connection.password=@dilbert
23:53:37,625 DEBUG [Configuration] connection.url=jdbc:db2://localhost:50000/HIBTEST
23:53:37,625 DEBUG [Configuration] connection.driver_class=com.ibm.db2.jcc.DB2Driver
23:53:37,625 DEBUG [Configuration] dialect=org.hibernate.dialect.DB2Dialect
23:53:37,625 DEBUG [Configuration] transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
23:53:37,625 DEBUG [Configuration] transaction.manager_lookup_class=org.hibernate.transaction.JOTMTransactionManagerLookup
23:53:37,625 DEBUG [Configuration] current_session_context_class=jta
23:53:37,625 DEBUG [Configuration] jta.UserTransaction=java:comp/UserTransaction
23:53:37,640 DEBUG [Configuration] null<-org.dom4j.tree.DefaultAttribute@2200d5 [Attribute: name resource value "test/UserObject.hbm.xml"]
23:53:37,640 INFO [Configuration] Mapping resource: test/UserObject.hbm.xml
23:53:37,640 DEBUG [DTDEntityResolver] trying to locate
http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/
23:53:37,640 DEBUG [DTDEntityResolver] found
http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath
23:53:37,812 INFO [HbmBinder] Mapping class: test.UserObject -> USEROBJECT
23:53:37,828 DEBUG [HbmBinder] Mapped property: id -> ID
23:53:37,843 DEBUG [HbmBinder] Mapped property: name -> NAME
23:53:37,843 INFO [Configuration] Configured SessionFactory: null
23:53:37,843 DEBUG [Configuration] properties: {hibernate.connection.password=@dilbert, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, transaction.factory_class=org.hibernate.transaction.JTATransactionFactory, sun.boot.library.path=d:\java\jdk1.5\jre\bin, java.vm.version=1.5.0-rc-b63, hibernate.connection.username=prhodes, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.os.patch.level=Service Pack 4, java.vm.specification.name=Java Virtual Machine Specification, user.dir=f:\learning\hibernate\TransactTest, java.runtime.version=1.5.0-rc-b63, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, hibernate.current_session_context_class=jta, java.endorsed.dirs=d:\java\jdk1.5\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\prhodes\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows 2000, jta.UserTransaction=java:comp/UserTransaction, sun.jnu.encoding=Cp1252, java.library.path=d:\java\jdk1.5\bin;.;C:\WINNT\system32;C:\WINNT;C:\WINNT\system32;C:\WINNT;C:\WINNT\system32\WBEM;d:\java\jdk1.5\bin;D:\java\apache-ant-1.6.1\bin;d:\java\jdk1.5\bin;d:\LANGUA~1\ada\bin;d:\program files\putty;S:\Program Files\IBM\WebSphere MQ\Java\lib;D:\languages\perl\bin\;d:\languages\ruby\bin;d:\program files\textpad4;S:\Program Files\IBM\WebSphere MQ\bin;S:\Program Files\IBM\WebSphere MQ\WEMPS\bin;d:\cygwin\bin;S:\PROGRA~1\IBM\SQLLIB\BIN;S:\PROGRA~1\IBM\SQLLIB\FUNCTION;S:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;S:\oracle\ora92\bin;S:\Program Files\Oracle\jre\1.3.1\bin;S:\Program Files\Oracle\jre\1.1.8\bin;D:\Program Files\WinSCP3\;D:\Program Files\WinCvs1.3\CVSNT;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;D:\Program Files\Microsoft Visual Studio\VC98\bin;d:\languages\rexx, java.specification.name=Java Platform API Specification, java.class.version=49.0, sun.management.compiler=HotSpot Client Compiler, hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory, os.version=5.0, connection.password=@dilbert, user.home=C:\Documents and Settings\prhodes, user.timezone=America/New_York, connection.username=prhodes, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.5, transaction.manager_lookup_class=org.hibernate.transaction.JOTMTransactionManagerLookup, hibernate.connection.driver_class=com.ibm.db2.jcc.DB2Driver, user.name=prhodes, java.class.path=f:\learning\hibernate\TransactTest\bin;S:\Program Files\ibm\SQLLIB\java\db2jcc.jar;D:\java\hibernate-3.0\hibernate3.jar;D:\java\hibernate-3.0\lib\ant-1.6.3.jar;D:\java\hibernate-3.0\lib\ant-antlr-1.6.3.jar;D:\java\hibernate-3.0\lib\ant-junit-1.6.3.jar;D:\java\hibernate-3.0\lib\ant-launcher-1.6.3.jar;D:\java\hibernate-3.0\lib\antlr-2.7.5H3.jar;D:\java\hibernate-3.0\lib\ant-swing-1.6.3.jar;D:\java\hibernate-3.0\lib\asm.jar;D:\java\hibernate-3.0\lib\asm-attrs.jar;D:\java\hibernate-3.0\lib\c3p0-0.8.5.2.jar;D:\java\hibernate-3.0\lib\cglib-2.1.jar;D:\java\hibernate-3.0\lib\cleanimports.jar;D:\java\hibernate-3.0\lib\commons-collections-2.1.1.jar;D:\java\hibernate-3.0\lib\commons-logging-1.0.4.jar;D:\java\hibernate-3.0\lib\concurrent-1.3.2.jar;D:\java\hibernate-3.0\lib\connector.jar;D:\java\hibernate-3.0\lib\dom4j-1.6.jar;D:\java\hibernate-3.0\lib\ehcache-1.1.jar;D:\java\hibernate-3.0\lib\jaas.jar;D:\java\hibernate-3.0\lib\jacc-1_0-fr.jar;D:\java\hibernate-3.0\lib\jaxen-1.1-beta-4.jar;D:\java\hibernate-3.0\lib\jboss-cache.jar;D:\java\hibernate-3.0\lib\jboss-common.jar;D:\java\hibernate-3.0\lib\jboss-jmx.jar;D:\java\hibernate-3.0\lib\jboss-system.jar;D:\java\hibernate-3.0\lib\jdbc2_0-stdext.jar;D:\java\hibernate-3.0\lib\jgroups-2.2.7.jar;D:\java\hibernate-3.0\lib\jta.jar;D:\java\hibernate-3.0\lib\junit-3.8.1.jar;D:\java\hibernate-3.0\lib\oscache-2.1.jar;D:\java\hibernate-3.0\lib\proxool-0.8.3.jar;D:\java\hibernate-3.0\lib\swarmcache-1.0rc2.jar;D:\java\hibernate-3.0\lib\versioncheck.jar;D:\java\hibernate-3.0\lib\xerces-2.6.2.jar;D:\java\hibernate-3.0\lib\xml-apis.jar;D:\java\hibernate-3.0\lib\log4j-1.2.9.jar;D:\java\spring-framework-1.2.5\dist\spring.jar;D:\java\jndi\fscontext\lib\fscontext.jar;D:\java\jndi\fscontext\lib\providerutil.jar;D:\java\jotm-2.0.10\lib\xapool.jar;D:\java\jotm-2.0.10\lib\commons-logging.jar;D:\java\jotm-2.0.10\lib\connector-1_5.jar;D:\java\jotm-2.0.10\lib\howl.jar;D:\java\jotm-2.0.10\lib\jotm.jar;D:\java\jotm-2.0.10\lib\jotm_iiop_stubs.jar;D:\java\jotm-2.0.10\lib\jotm_jrmp_stubs.jar;D:\java\jotm-2.0.10\lib\jts1_0.jar;D:\java\jotm-2.0.10\lib\log4j.jar;D:\java\jotm-2.0.10\lib\objectweb-datasource.jar;D:\java\jotm-2.0.10\lib\ow_carol.jar;D:\java\jotm-2.0.10\lib\commons-cli-1.0.jar, current_session_context_class=jta, java.vm.specification.version=1.0, java.home=d:\java\jdk1.5\jre, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.DB2Dialect, hibernate.connection.url=jdbc:db2://localhost:50000/HIBTEST, user.language=en, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, java.version=1.5.0-rc, java.ext.dirs=d:\java\jdk1.5\jre\lib\ext, sun.boot.class.path=d:\java\jdk1.5\jre\lib\rt.jar;d:\java\jdk1.5\jre\lib\i18n.jar;d:\java\jdk1.5\jre\lib\sunrsasign.jar;d:\java\jdk1.5\jre\lib\jsse.jar;d:\java\jdk1.5\jre\lib\jce.jar;d:\java\jdk1.5\jre\lib\charsets.jar;d:\java\jdk1.5\jre\classes, java.vendor=Sun Microsystems Inc., hibernate.jta.UserTransaction=java:comp/UserTransaction, connection.driver_class=com.ibm.db2.jcc.DB2Driver, file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JOTMTransactionManagerLookup, sun.desktop=windows, connection.url=jdbc:db2://localhost:50000/HIBTEST, dialect=org.hibernate.dialect.DB2Dialect, sun.cpu.isalist=}
23:53:37,843 DEBUG [Configuration] Preparing to build session factory with filters : {}
23:53:37,843 INFO [Configuration] processing extends queue
23:53:37,843 INFO [Configuration] processing collection mappings
23:53:37,843 INFO [Configuration] processing association property references
23:53:37,843 INFO [Configuration] processing foreign key constraints
23:53:37,953 INFO [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
23:53:37,953 INFO [DriverManagerConnectionProvider] Hibernate connection pool size: 20
23:53:37,953 INFO [DriverManagerConnectionProvider] autocommit mode: false
23:53:37,968 INFO [DriverManagerConnectionProvider] using driver: com.ibm.db2.jcc.DB2Driver at URL: jdbc:db2://localhost:50000/HIBTEST
23:53:37,968 INFO [DriverManagerConnectionProvider] connection properties: {user=prhodes, password=@dilbert}
23:53:37,968 DEBUG [DriverManagerConnectionProvider] total checked-out connections: 0
23:53:37,968 DEBUG [DriverManagerConnectionProvider] opening new JDBC connection
23:53:38,312 DEBUG [DriverManagerConnectionProvider] created connection to: jdbc:db2://localhost:50000/HIBTEST, Isolation Level: 2
23:53:38,312 DEBUG [SettingsFactory] could not get database version from JDBC metadata
23:53:38,312 INFO [SettingsFactory] RDBMS: DB2/NT, version: SQL08010
23:53:38,312 INFO [SettingsFactory] JDBC driver: IBM DB2 JDBC Universal Driver Architecture, version: 1.0.581
23:53:38,312 DEBUG [DriverManagerConnectionProvider] returning connection to pool, pool size: 1
23:53:38,359 INFO [Dialect] Using dialect: org.hibernate.dialect.DB2Dialect
23:53:38,359 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.transaction.JTATransactionFactory
23:53:38,375 INFO [NamingHelper] JNDI InitialContext properties:{}
23:53:38,375 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JOTMTransactionManagerLookup
23:53:38,375 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
23:53:38,375 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
23:53:38,375 INFO [SettingsFactory] Automatic session close at end of transaction: disabled
23:53:38,375 INFO [SettingsFactory] Scrollable result sets: enabled
23:53:38,375 DEBUG [SettingsFactory] Wrap result sets: disabled
23:53:38,375 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
23:53:38,375 INFO [SettingsFactory] Connection release mode: null
23:53:38,375 INFO [SettingsFactory] Default batch fetch size: 1
23:53:38,375 INFO [SettingsFactory] Generate SQL with comments: disabled
23:53:38,375 INFO [SettingsFactory] Order SQL updates by primary key: disabled
23:53:38,375 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
23:53:38,390 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
23:53:38,390 INFO [SettingsFactory] Query language substitutions: {}
23:53:38,390 INFO [SettingsFactory] Second-level cache: enabled
23:53:38,390 INFO [SettingsFactory] Query cache: disabled
23:53:38,390 INFO [SettingsFactory] Cache provider: org.hibernate.cache.EhCacheProvider
23:53:38,390 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
23:53:38,390 INFO [SettingsFactory] Structured second-level cache entries: disabled
23:53:38,390 DEBUG [SQLExceptionConverterFactory] Using dialect defined converter
23:53:38,406 INFO [SettingsFactory] Statistics: disabled
23:53:38,406 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
23:53:38,406 INFO [SettingsFactory] Default entity-mode: pojo
23:53:38,593 INFO [SessionFactoryImpl] building session factory
23:53:38,593 DEBUG [SessionFactoryImpl] Session factory constructed with filter configurations : {}
23:53:38,609 DEBUG [SessionFactoryImpl] instantiating session factory with properties: {hibernate.connection.password=@dilbert, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, transaction.factory_class=org.hibernate.transaction.JTATransactionFactory, sun.boot.library.path=d:\java\jdk1.5\jre\bin, java.vm.version=1.5.0-rc-b63, hibernate.connection.username=prhodes, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.os.patch.level=Service Pack 4, java.vm.specification.name=Java Virtual Machine Specification, user.dir=f:\learning\hibernate\TransactTest, java.runtime.version=1.5.0-rc-b63, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, hibernate.current_session_context_class=jta, java.endorsed.dirs=d:\java\jdk1.5\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\prhodes\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows 2000, jta.UserTransaction=java:comp/UserTransaction, sun.jnu.encoding=Cp1252, java.library.path=d:\java\jdk1.5\bin;.;C:\WINNT\system32;C:\WINNT;C:\WINNT\system32;C:\WINNT;C:\WINNT\system32\WBEM;d:\java\jdk1.5\bin;D:\java\apache-ant-1.6.1\bin;d:\java\jdk1.5\bin;d:\LANGUA~1\ada\bin;d:\program files\putty;S:\Program Files\IBM\WebSphere MQ\Java\lib;D:\languages\perl\bin\;d:\languages\ruby\bin;d:\program files\textpad4;S:\Program Files\IBM\WebSphere MQ\bin;S:\Program Files\IBM\WebSphere MQ\WEMPS\bin;d:\cygwin\bin;S:\PROGRA~1\IBM\SQLLIB\BIN;S:\PROGRA~1\IBM\SQLLIB\FUNCTION;S:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;S:\oracle\ora92\bin;S:\Program Files\Oracle\jre\1.3.1\bin;S:\Program Files\Oracle\jre\1.1.8\bin;D:\Program Files\WinSCP3\;D:\Program Files\WinCvs1.3\CVSNT;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;D:\Program Files\Microsoft Visual Studio\VC98\bin;d:\languages\rexx, java.specification.name=Java Platform API Specification, java.class.version=49.0, sun.management.compiler=HotSpot Client Compiler, hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory, os.version=5.0, connection.password=@dilbert, user.home=C:\Documents and Settings\prhodes, user.timezone=America/New_York, connection.username=prhodes, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.5, transaction.manager_lookup_class=org.hibernate.transaction.JOTMTransactionManagerLookup, hibernate.connection.driver_class=com.ibm.db2.jcc.DB2Driver, user.name=prhodes, java.class.path=f:\learning\hibernate\TransactTest\bin;S:\Program Files\ibm\SQLLIB\java\db2jcc.jar;D:\java\hibernate-3.0\hibernate3.jar;D:\java\hibernate-3.0\lib\ant-1.6.3.jar;D:\java\hibernate-3.0\lib\ant-antlr-1.6.3.jar;D:\java\hibernate-3.0\lib\ant-junit-1.6.3.jar;D:\java\hibernate-3.0\lib\ant-launcher-1.6.3.jar;D:\java\hibernate-3.0\lib\antlr-2.7.5H3.jar;D:\java\hibernate-3.0\lib\ant-swing-1.6.3.jar;D:\java\hibernate-3.0\lib\asm.jar;D:\java\hibernate-3.0\lib\asm-attrs.jar;D:\java\hibernate-3.0\lib\c3p0-0.8.5.2.jar;D:\java\hibernate-3.0\lib\cglib-2.1.jar;D:\java\hibernate-3.0\lib\cleanimports.jar;D:\java\hibernate-3.0\lib\commons-collections-2.1.1.jar;D:\java\hibernate-3.0\lib\commons-logging-1.0.4.jar;D:\java\hibernate-3.0\lib\concurrent-1.3.2.jar;D:\java\hibernate-3.0\lib\connector.jar;D:\java\hibernate-3.0\lib\dom4j-1.6.jar;D:\java\hibernate-3.0\lib\ehcache-1.1.jar;D:\java\hibernate-3.0\lib\jaas.jar;D:\java\hibernate-3.0\lib\jacc-1_0-fr.jar;D:\java\hibernate-3.0\lib\jaxen-1.1-beta-4.jar;D:\java\hibernate-3.0\lib\jboss-cache.jar;D:\java\hibernate-3.0\lib\jboss-common.jar;D:\java\hibernate-3.0\lib\jboss-jmx.jar;D:\java\hibernate-3.0\lib\jboss-system.jar;D:\java\hibernate-3.0\lib\jdbc2_0-stdext.jar;D:\java\hibernate-3.0\lib\jgroups-2.2.7.jar;D:\java\hibernate-3.0\lib\jta.jar;D:\java\hibernate-3.0\lib\junit-3.8.1.jar;D:\java\hibernate-3.0\lib\oscache-2.1.jar;D:\java\hibernate-3.0\lib\proxool-0.8.3.jar;D:\java\hibernate-3.0\lib\swarmcache-1.0rc2.jar;D:\java\hibernate-3.0\lib\versioncheck.jar;D:\java\hibernate-3.0\lib\xerces-2.6.2.jar;D:\java\hibernate-3.0\lib\xml-apis.jar;D:\java\hibernate-3.0\lib\log4j-1.2.9.jar;D:\java\spring-framework-1.2.5\dist\spring.jar;D:\java\jndi\fscontext\lib\fscontext.jar;D:\java\jndi\fscontext\lib\providerutil.jar;D:\java\jotm-2.0.10\lib\xapool.jar;D:\java\jotm-2.0.10\lib\commons-logging.jar;D:\java\jotm-2.0.10\lib\connector-1_5.jar;D:\java\jotm-2.0.10\lib\howl.jar;D:\java\jotm-2.0.10\lib\jotm.jar;D:\java\jotm-2.0.10\lib\jotm_iiop_stubs.jar;D:\java\jotm-2.0.10\lib\jotm_jrmp_stubs.jar;D:\java\jotm-2.0.10\lib\jts1_0.jar;D:\java\jotm-2.0.10\lib\log4j.jar;D:\java\jotm-2.0.10\lib\objectweb-datasource.jar;D:\java\jotm-2.0.10\lib\ow_carol.jar;D:\java\jotm-2.0.10\lib\commons-cli-1.0.jar, current_session_context_class=jta, java.vm.specification.version=1.0, java.home=d:\java\jdk1.5\jre, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.DB2Dialect, hibernate.connection.url=jdbc:db2://localhost:50000/HIBTEST, user.language=en, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, java.version=1.5.0-rc, java.ext.dirs=d:\java\jdk1.5\jre\lib\ext, sun.boot.class.path=d:\java\jdk1.5\jre\lib\rt.jar;d:\java\jdk1.5\jre\lib\i18n.jar;d:\java\jdk1.5\jre\lib\sunrsasign.jar;d:\java\jdk1.5\jre\lib\jsse.jar;d:\java\jdk1.5\jre\lib\jce.jar;d:\java\jdk1.5\jre\lib\charsets.jar;d:\java\jdk1.5\jre\classes, java.vendor=Sun Microsystems Inc., hibernate.jta.UserTransaction=java:comp/UserTransaction, connection.driver_class=com.ibm.db2.jcc.DB2Driver, file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JOTMTransactionManagerLookup, sun.desktop=windows, connection.url=jdbc:db2://localhost:50000/HIBTEST, dialect=org.hibernate.dialect.DB2Dialect, sun.cpu.isalist=}
23:53:38,625 WARN [Configurator] No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/java/hibernate-3.0/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
23:53:39,093 DEBUG [BasicEntityPersister] Static SQL for entity: test.UserObject
23:53:39,093 DEBUG [BasicEntityPersister] Version select: select ID from USEROBJECT where ID =?
23:53:39,093 DEBUG [BasicEntityPersister] Snapshot select: select userobject_.ID, userobject_.NAME as NAME0_ from USEROBJECT userobject_ where userobject_.ID=?
23:53:39,093 DEBUG [BasicEntityPersister] Insert 0: insert into USEROBJECT (NAME, ID) values (?, ?)
23:53:39,093 DEBUG [BasicEntityPersister] Update 0: update USEROBJECT set NAME=? where ID=?
23:53:39,093 DEBUG [BasicEntityPersister] Delete 0: delete from USEROBJECT where ID=?
23:53:39,093 DEBUG [BasicEntityPersister] Identity insert: insert into USEROBJECT (NAME, ID) values (?, default)
23:53:39,125 DEBUG [EntityLoader] Static select for entity test.UserObject: select userobject0_.ID as ID0_, userobject0_.NAME as NAME0_0_ from USEROBJECT userobject0_ where userobject0_.ID=?
23:53:39,125 DEBUG [EntityLoader] Static select for entity test.UserObject: select userobject0_.ID as ID0_, userobject0_.NAME as NAME0_0_ from USEROBJECT userobject0_ where userobject0_.ID=?
23:53:39,125 DEBUG [EntityLoader] Static select for entity test.UserObject: select userobject0_.ID as ID0_, userobject0_.NAME as NAME0_0_ from USEROBJECT userobject0_ where userobject0_.ID=? for update with rr
23:53:39,125 DEBUG [EntityLoader] Static select for entity test.UserObject: select userobject0_.ID as ID0_, userobject0_.NAME as NAME0_0_ from USEROBJECT userobject0_ where userobject0_.ID=? for update with rr
23:53:39,125 DEBUG [SessionFactoryObjectFactory] initializing class SessionFactoryObjectFactory
23:53:39,140 DEBUG [SessionFactoryObjectFactory] registered: 4028825b0874dd2e010874dd30b50000 (unnamed)
23:53:39,140 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
23:53:39,140 DEBUG [SessionFactoryImpl] instantiated session factory
23:53:39,140 DEBUG [SessionFactoryImpl] obtaining JTA TransactionManager
23:53:39,140 INFO [SessionFactoryImpl] Checking 0 named queries
23:53:39,140 DEBUG [jta] begin transaction
23:53:39,140 DEBUG [jta] threadTx.get= java.lang.ThreadLocal@608760
23:53:39,156 DEBUG [jta] xid= bb14:38:0:016c8570f54bec9d27...c35001:
23:53:39,156 DEBUG [jta] timeout= 60
23:53:39,156 DEBUG [jta] xid=bb14:38:0:016c8570f54bec9d27...c35001:, timeout=60
23:53:39,156 DEBUG [jta] tx=bb14:38:0:016c8570f54bec9d27...c35001:
23:53:39,156 DEBUG [jta] TransactionImpl.doAttach flag= TMJOIN
23:53:39,156 DEBUG [jta] number of enlisted= 0
23:53:39,156 DEBUG [jta] threadTx.set= java.lang.ThreadLocal@608760
23:53:39,156 DEBUG [jta] Associate tx to xid (xid=bb14:38:0:016c8570f54bec9d27...c35001:)
23:53:39,171 DEBUG [jta] TimerEvent.new(bb14:38:0:016c8570f54bec9d27...c35001:,60,null,false)
23:53:39,171 DEBUG [jta] set timer for tx (timer=org.objectweb.jotm.TimerEvent@17aece8, tx=bb14:38:0:016c8570f54bec9d27...c35001:)
23:53:39,187 DEBUG [jta] set date for tx (data=Wed Dec 28 23:53:39 EST 2005, tx=bb14:38:0:016c8570f54bec9d27...c35001:)
23:53:39,187 DEBUG [jta] threadTx.get= java.lang.ThreadLocal@608760
23:53:39,187 DEBUG [jta] Transaction ret= bb14:38:0:016c8570f54bec9d27...c35001:
23:53:39,187 DEBUG [jta] TransactionImpl.getStatus()
23:53:39,250 DEBUG [jta] threadTx.get= java.lang.ThreadLocal@608760
23:53:39,250 DEBUG [jta] Transaction ret= bb14:38:0:016c8570f54bec9d27...c35001:
23:53:39,250 DEBUG [jta] TransactionImpl.getStatus()
23:53:39,250 DEBUG [jta] TransactionImpl.registerSynchronization(Synchronization sync)
23:53:39,250 DEBUG [jta] make subcoordinator
23:53:39,265 DEBUG [jta] tx=bb14:38:0:016c8570f54bec9d27...c35001:, xid=bb14:38:0:016c8570f54bec9d27...c35001:
23:53:39,265 DEBUG [jta] synchro=org.hibernate.transaction.CacheSynchronization
23:53:39,265 DEBUG [jta] status=STATUS_ACTIVE
23:53:39,265 DEBUG [JDBCContext] successfully registered Synchronization
23:53:39,265 DEBUG [SessionImpl] opened session at timestamp: 4652367950655488
23:53:39,281 DEBUG [jta] TransactionImpl.registerSynchronization(Synchronization sync)
23:53:39,281 DEBUG [jta] synchro=org.hibernate.impl.SessionFactoryImpl$CurrentSessionCleanupSynch@1c8efd1
23:53:39,281 DEBUG [jta] status=STATUS_ACTIVE
23:53:39,281 DEBUG [JTATransaction] begin
23:53:39,281 DEBUG [JTATransaction] Looking for UserTransaction under: java:comp/UserTransaction
23:53:39,281 DEBUG [JTATransaction] Obtained UserTransaction
23:53:39,281 DEBUG [jta] Current.getStatus()
23:53:39,281 DEBUG [jta] threadTx.get= java.lang.ThreadLocal@608760
23:53:39,281 DEBUG [jta] Transaction ret= bb14:38:0:016c8570f54bec9d27...c35001:
23:53:39,281 DEBUG [jta] TransactionImpl.getStatus()
23:53:39,281 DEBUG [jta] status=STATUS_ACTIVE
23:53:39,281 DEBUG [DefaultSaveOrUpdateEventListener] saving transient instance
23:53:39,296 DEBUG [AbstractSaveEventListener] saving [test.UserObject#<null>]
23:53:39,296 DEBUG [AbstractSaveEventListener] executing insertions
23:53:39,296 DEBUG [BasicEntityPersister] Inserting entity: test.UserObject (native id)
23:53:39,296 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
23:53:39,296 DEBUG [ConnectionManager] opening JDBC connection
23:53:39,312 DEBUG [DriverManagerConnectionProvider] total checked-out connections: 0
23:53:39,312 DEBUG [DriverManagerConnectionProvider] using pooled JDBC connection, pool size: 0
23:53:39,312 DEBUG [SQL] insert into USEROBJECT (NAME, ID) values (?, default)
23:53:39,312 DEBUG [AbstractBatcher] preparing statement
23:53:39,359 DEBUG [BasicEntityPersister] Dehydrating entity: [test.UserObject#<null>]
23:53:39,359 DEBUG [StringType] binding 'PhillipRhodes' to parameter: 1
23:53:39,375 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
23:53:39,375 DEBUG [AbstractBatcher] closing statement
23:53:39,375 DEBUG [ConnectionManager] aggressively releasing JDBC connection
23:53:39,375 DEBUG [ConnectionManager] closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
23:53:39,375 DEBUG [DriverManagerConnectionProvider] returning connection to pool, pool size: 1
23:53:39,375 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
23:53:39,375 DEBUG [ConnectionManager] opening JDBC connection
23:53:39,375 DEBUG [DriverManagerConnectionProvider] total checked-out connections: 0
23:53:39,375 DEBUG [DriverManagerConnectionProvider] using pooled JDBC connection, pool size: 0
23:53:39,375 DEBUG [SQL] values identity_val_local()
23:53:39,375 DEBUG [AbstractBatcher] preparing statement
23:53:39,421 DEBUG [IdentifierGeneratorFactory] Natively generated identity: 21
23:53:39,421 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
23:53:39,421 DEBUG [AbstractBatcher] closing statement
23:53:39,421 DEBUG [ConnectionManager] aggressively releasing JDBC connection
23:53:39,421 DEBUG [ConnectionManager] closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
23:53:39,421 DEBUG [DriverManagerConnectionProvider] returning connection to pool, pool size: 1
23:53:39,437 DEBUG [JTATransaction] commit
23:53:39,437 DEBUG [SessionImpl] closing session
23:53:39,437 DEBUG [jta] commit transaction
23:53:39,437 DEBUG [jta] threadTx.get= java.lang.ThreadLocal@608760
23:53:39,437 DEBUG [jta] Transaction ret= bb14:38:0:016c8570f54bec9d27...c35001:
23:53:39,437 DEBUG [jta] tx=bb14:38:0:016c8570f54bec9d27...c35001:
23:53:39,437 DEBUG [jta] TransactionImpl.commit (tx= bb14:38:0:016c8570f54bec9d27...c35001:)
23:53:39,437 DEBUG [jta] status=STATUS_ACTIVE
23:53:39,437 DEBUG [jta] doBeforeCompletion committing= true
23:53:39,437 DEBUG [jta] unset timer for tx (timer=org.objectweb.jotm.TimerEvent@17aece8, tx=bb14:38:0:016c8570f54bec9d27...c35001:)
23:53:39,437 DEBUG [jta] TimerEvent(bb14:38:0:016c8570f54bec9d27...c35001:).unset
23:53:39,437 DEBUG [jta] threadTx.get= java.lang.ThreadLocal@608760
23:53:39,437 DEBUG [jta] Transaction ret= bb14:38:0:016c8570f54bec9d27...c35001:
23:53:39,437 DEBUG [jta] sychronization list size= 2
23:53:39,437 DEBUG [jta] Synchronization sync= org.hibernate.transaction.CacheSynchronization
23:53:39,437 DEBUG [CacheSynchronization] transaction before completion callback
23:53:39,437 DEBUG [jta] TransactionImpl.getStatus()
23:53:39,437 DEBUG [jta] status=STATUS_ACTIVE
23:53:39,437 DEBUG [CacheSynchronization] automatically flushing session
23:53:39,437 DEBUG [SessionImpl] automatically flushing session
23:53:39,437 DEBUG [JDBCContext] before transaction completion
23:53:39,437 DEBUG [SessionImpl] before transaction completion
23:53:39,437 DEBUG [jta] Synchronization sync= org.hibernate.impl.SessionFactoryImpl$CurrentSessionCleanupSynch@1c8efd1
23:53:39,437 DEBUG [jta] TransactionImpl.doDetach flag= TMSUCCESS
23:53:39,437 DEBUG [jta] number of enlisted= 0
23:53:39,437 DEBUG [jta] status=STATUS_ACTIVE
23:53:39,437 DEBUG [jta] SubCoordinator.doPrepare()
23:53:39,437 DEBUG [jta] doAfterCompletion()
23:53:39,437 DEBUG [jta] sychronization list size= 2
23:53:39,437 DEBUG [jta] Synchronization sync= org.hibernate.transaction.CacheSynchronization
23:53:39,437 DEBUG [jta] sync.afterCompletion status= STATUS_COMMITTED
23:53:39,437 DEBUG [CacheSynchronization] transaction after completion callback, status: 3
23:53:39,437 DEBUG [JDBCContext] after transaction completion
23:53:39,437 DEBUG [SessionImpl] after transaction completion
23:53:39,437 DEBUG [jta] Synchronization sync= org.hibernate.impl.SessionFactoryImpl$CurrentSessionCleanupSynch@1c8efd1
23:53:39,437 DEBUG [jta] sync.afterCompletion status= STATUS_COMMITTED
23:53:39,437 DEBUG [jta] threadTx.set = null
23:53:39,437 DEBUG [jta] remove tx from xid (xid=bb14:38:0:016c8570f54bec9d27...c35001:)
23:53:39,437 DEBUG [jta] SubCoordinator unexported [subcoord=org.objectweb.jotm.SubCoordinator@6397eb]
23:53:39,437 DEBUG [jta] threadTx.set= null
23:53:39,437 DEBUG [jta] reset timeout= 60
23:53:39,437 INFO [jotm] stop JOTM
23:53:39,437 DEBUG [jta] threadTx.set= null
23:53:39,437 DEBUG [jotm] TransactionFactory unexported
23:53:39,437 WARN [TestDriver] done
main code :
package test;
import java.io.File;
import javax.naming.InitialContext;
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.objectweb.jotm.Jotm;
import org.objectweb.transaction.jta.TMService;
public class TestDriver
{
/**
* @param args
*/
public static void main( String[] args )
{
// BasicConfigurator.configure();
DOMConfigurator.configure( "log4j.xml" );
Configuration config = new Configuration();
Logger logger = Logger.getLogger( TestDriver.class );
logger.warn( "Welcome to TRANSACT!" );
try
{
/* startup JOTM */
TMService jotm = new Jotm(true, false);
/* and get a UserTransaction */
UserTransaction ut = jotm.getUserTransaction();
// setup JNDI
System.setProperty( "java.naming.factory.initial", "com.sun.jndi.fscontext.RefFSContextFactory" );
InitialContext jndi = new InitialContext();
// bind the userTransaction into JNDI
jndi.bind( "java:comp/UserTransaction", ut );
File file = new File( "./hibernate.cfg.xml" );
SessionFactory sf = config.configure( file ).buildSessionFactory();
// begin a new Transaction
ut.begin();
// and open the Hibernate session
Session session = sf.getCurrentSession();
// there's an existing transaction, hibernate will use it?
Transaction tx = session.beginTransaction();
// do something transactional using Hibernate
UserObject obj = new UserObject( "PhillipRhodes" );
session.save( obj );
// commit that action
tx.commit();
// close the hibernate session
session.close();
// do something else involving the transaction (send a JMS message, for example)
// TODO: add a separate transactional step here
// commit the transaction
ut.commit();
// stop the transaction manager
jotm.stop();
// goodbye...
logger.warn( "done" );
}
catch( Exception e )
{
e.printStackTrace();
}
}
}
code for a stupid little persistent class
package test;
public class UserObject
{
private Long id;
private String name;
public UserObject()
{
}
public UserObject( String name )
{
this.name = name;
}
public Long getId()
{
return id;
}
public void setId( Long id )
{
if( this.id == null )
{
this.id = id;
}
else
{
throw new RuntimeException( "attempt to modify immutable field \"id\" with value: " + this.id );
}
}
public void setName( String name )
{
this.name = name;
}
public String getName()
{
return name;
}
}
Hi all, sorry if this is more of a JOTM question than a Hibernate question,
but I'm a little confused. I've read what appear to be the relevant
sections of the references docs, as well as the community doc on
transactions, and I'm still missing something.
The problem is, using the above configuration and code, the transaction
somehow winds up never being finally committed. That is, when the
program ends, nothing has been written to the persistent store. OTOH, if I
comment out the jotm.stop() line, and check the database while the
program is still running, I can see the transaction in the database. It
appears that somehow JOTM is never finalizing the commit, and is
ultimately rolling it back when stopped (or just doing nothing, and the
underlying database is eventually doing the rollback, I'm not sure which).
Can somebody help clarify for me how this combination works? I thought
I was to create a new JTA transaction with ut.begin(), but that I still
needed to call session.beginTransaction(), with Hibernate picking up the
existing JTA transaction and using it..
In turn, I was expecting to need to call commit() on the Hibernate
transaction, to demarcate that that part of what might eventually be a
distributed transaction was done. And then finally, after doing any other
transactional steps, I thought to call ut.commit() (or ut.rollback() ) to finish
things up.
Obviously I'm missing something in my understanding however, as this
does not work. Worse, I've tried every imaginable (to me) permutation of
ways to begin and commit the transaction and can't find a way to make it
actually work, even by trial and error.
Also, FWIW, this is only a sample program I cooked up to experiment with
this very issue... it's not meant to reflect any real world use case, other
than my need to understand how this all works. I do eventually forsee a
need to combine a hibernate action with other transactional actions (such
as sending a JMS message), which is why I'm trying to figure this out.
Thanks in advance for any and all help.
-- phil