I have an piece of code using parent child semantics and it doesnt store any records in the db. looked at it till i am blue in the face and cant see what i've done wrong.
in desperation i've abstracted it back to a real simple example as per user guide. This also doesnt persist any rows. I must be missing something but I cant see it.
Can any one spot what i've missed - just feeling a bit stupid, however
The database tables get created fine and the foreign key constraints look okay - its just no data gets in into the tables.
Hibernate version: v3rc1
Mapping documents:
Parent mapping
Code:
hibernate-mapping package="tmp">
<class name="Parent" table="Parent" >
<id name="parID" type = "long" column="parID" unsaved-value="0" >
<generator class="increment"/>
</id>
<version name="version"
type="int"
column="par_version"/>
<property name="key" type = "java.lang.Long" column="par_uniqueKey" unique="true" update="false" />
<property name="name" type = "java.lang.String" column="par_name" length="100" />
<set name="children" inverse="true" cascade="all" lazy = "true">
<key column="chd_parent"/>
<one-to-many class="Child"/>
</set>
</class>
</hibernate-mapping>
child mapping
Code:
<hibernate-mapping package="tmp">
<class name="Child" table="Child" >
<id name="chdID" type = "long" column="chdID" unsaved-value="0" >
<generator class="increment"/>
</id>
<version name="version"
type="int"
column="chd_version"/>
<property name="key" type = "java.lang.Long" column="chd_uniqueKey" unique="true" update="false"/>
<property name="name" type = "java.lang.String" column="chd_name" length="100" />
<!-- declare foreign key to self, allow for null as org instance may be at the top -->
<many-to-one name="parent" column="chd_parent" cascade="all" lazy = "true"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
public class HibernatePersistenceManager implements PersistenceManager
{
...
public void init ()
{
String udir = System.getProperty ("user.dir");
String bin = udir+ File.separator + "persistence" + File.separator ;
File hcfg = new File (bin, "hibernate.cfg.xml");
// Set up a simple logging configuration that logs on the console
BasicConfigurator.configure();
Configuration config = new Configuration ();
config.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider");
config.addClass(tmp.Parent.class);
config.addClass(tmp.Child.class);
try
{
config.configure(hcfg);
// let hibernate update the database
new SchemaUpdate (config).execute(true, true);
// one off once built sessionFactory is immutable
sessionFactory = config.buildSessionFactory();
} catch (HibernateException he)
{
throw new RuntimeException (he.getMessage(), he);
}
}
Then in my demo main function I call the following
Code:
public static void main(String[] args)
{
final HibernatePersistenceManager pm ;
pm = new HibernatePersistenceManager ();
pm.init();
Parent p = new Parent ("mum");
Child c = new Child ("Tobias");
p.addChild(c);
pm.getSession().save(c);
pm.getSession().flush();
pm.getSession().close();
Full stack trace of any exception that occurs:none -
Name and version of the database you are using: mysql v4.1The generated SQL (show_sql=true):Code:
0 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.0rc1
10 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
10 [main] INFO org.hibernate.cfg.Environment - using CGLIB reflection optimizer
20 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
20 [main] INFO org.hibernate.cfg.Configuration - Mapping resource: tmp/Parent.hbm.xml
491 [main] DEBUG org.hibernate.util.DTDEntityResolver - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/
491 [main] DEBUG org.hibernate.util.DTDEntityResolver - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath
751 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: tmp.Parent -> Parent
751 [main] DEBUG org.hibernate.cfg.HbmBinder - Mapped property: parID -> parID
761 [main] DEBUG org.hibernate.cfg.HbmBinder - Mapped property: version -> par_version
791 [main] DEBUG org.hibernate.cfg.HbmBinder - Mapped property: key -> par_uniqueKey
791 [main] DEBUG org.hibernate.cfg.HbmBinder - Mapped property: name -> par_name
791 [main] DEBUG org.hibernate.cfg.HbmBinder - Mapped property: children
801 [main] INFO org.hibernate.cfg.Configuration - Mapping resource: tmp/Child.hbm.xml
811 [main] DEBUG org.hibernate.util.DTDEntityResolver - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/
821 [main] DEBUG org.hibernate.util.DTDEntityResolver - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath
901 [main] INFO org.hibernate.cfg.HbmBinder - Mapping class: tmp.Child -> Child
911 [main] DEBUG org.hibernate.cfg.HbmBinder - Mapped property: chdID -> chdID
911 [main] DEBUG org.hibernate.cfg.HbmBinder - Mapped property: version -> chd_version
911 [main] DEBUG org.hibernate.cfg.HbmBinder - Mapped property: key -> chd_uniqueKey
921 [main] DEBUG org.hibernate.cfg.HbmBinder - Mapped property: name -> chd_name
1041 [main] DEBUG org.hibernate.cfg.HbmBinder - Mapped property: parent -> chd_parent
1051 [main] INFO org.hibernate.cfg.Configuration - configuring from file: hibernate.cfg.xml
1061 [main] DEBUG org.hibernate.util.DTDEntityResolver - trying to locate http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd in classpath under org/hibernate/
1061 [main] DEBUG org.hibernate.util.DTDEntityResolver - found http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd in classpath
1081 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.connection.driver_class=com.mysql.jdbc.Driver
1081 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.connection.url=jdbc:mysql://localhost:3306/test
1091 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.connection.username=woodmawa
1091 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.connection.password=
1091 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
1091 [main] DEBUG org.hibernate.cfg.Configuration - hibernate.connection.pool_size=4
1091 [main] DEBUG org.hibernate.cfg.Configuration - show_sql=true
1091 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
1091 [main] DEBUG org.hibernate.cfg.Configuration - properties: {hibernate.connection.password=, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, sun.boot.library.path=D:\jdk1.5.0\jre\bin, java.vm.version=1.5.0-b64, hibernate.connection.username=woodmawa, 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=GB, sun.os.patch.level=Service Pack 4, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\eclipse\workspace\hibernate\bin, java.runtime.version=1.5.0-b64, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=D:\jdk1.5.0\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=D:\DOCUME~1\woodmawa\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows 2000, sun.jnu.encoding=Cp1252, java.library.path=D:\jdk1.5.0\bin;.;C:\WINNT\system32;C:\WINNT;D:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;D:\Program Files\Rational\common;D:\Program Files\MySQL\MySQL Server 4.1\bin, java.specification.name=Java Platform API Specification, java.class.version=49.0, hibernate.connection.pool_size=4, sun.management.compiler=HotSpot Client Compiler, os.version=5.0, user.home=D:\Documents and Settings\woodmawa, user.timezone=, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.5, hibernate.connection.driver_class=com.mysql.jdbc.Driver, show_sql=true, user.name=woodmawa, java.class.path=D:\eclipse\workspace\hibernate\bin;D:\hibernate-3.0\hibernate3.jar;D:\hibernate-3.0\lib\xml-apis.jar;D:\hibernate-3.0\lib\ant-antlr-1.6.2.jar;D:\hibernate-3.0\lib\ant-junit-1.6.2.jar;D:\hibernate-3.0\lib\ant-launcher-1.6.2.jar;D:\hibernate-3.0\lib\antlr-2.7.4.jar;D:\hibernate-3.0\lib\ant-swing-1.6.2.jar;D:\hibernate-3.0\lib\c3p0-0.8.5.jar;D:\hibernate-3.0\lib\cglib-full-2.0.2.jar;D:\hibernate-3.0\lib\cleanimports.jar;D:\hibernate-3.0\lib\commons-collections-2.1.1.jar;D:\hibernate-3.0\lib\commons-logging-1.0.4.jar;D:\hibernate-3.0\lib\concurrent-1.3.2.jar;D:\hibernate-3.0\lib\connector.jar;D:\hibernate-3.0\lib\dom4j-1.5.2.jar;D:\hibernate-3.0\lib\ehcache-1.1.jar;D:\hibernate-3.0\lib\jaas.jar;D:\hibernate-3.0\lib\jacc-1_0-fr.jar;D:\hibernate-3.0\lib\jaxen-1.1-beta-4.jar;D:\hibernate-3.0\lib\jboss-cache.jar;D:\hibernate-3.0\lib\jboss-common.jar;D:\hibernate-3.0\lib\jboss-jmx.jar;D:\hibernate-3.0\lib\jboss-remoting.jar;D:\hibernate-3.0\lib\jboss-system.jar;D:\hibernate-3.0\lib\jdbc2_0-stdext.jar;D:\hibernate-3.0\lib\jgroups-2.2.7.jar;D:\hibernate-3.0\lib\jta.jar;D:\hibernate-3.0\lib\junit-3.8.1.jar;D:\hibernate-3.0\lib\log4j-1.2.9.jar;D:\hibernate-3.0\lib\oscache-2.1.jar;D:\hibernate-3.0\lib\proxool-0.8.3.jar;D:\hibernate-3.0\lib\swarmcache-1.0rc2.jar;D:\hibernate-3.0\lib\versioncheck.jar;D:\hibernate-3.0\lib\xerces-2.6.2.jar;D:\hibernate-3.0\lib\ant-1.6.2.jar;D:\downloads\Xdoclet\xdoclet-bin-1.2.2.zip, hibernate.show_sql=true, java.vm.specification.version=1.0, java.home=D:\jdk1.5.0\jre, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect, hibernate.connection.url=jdbc:mysql://localhost:3306/test, 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, sharing, java.version=1.5.0, java.ext.dirs=D:\jdk1.5.0\jre\lib\ext, sun.boot.class.path=D:\jdk1.5.0\jre\lib\rt.jar;D:\jdk1.5.0\jre\lib\i18n.jar;D:\jdk1.5.0\jre\lib\sunrsasign.jar;D:\jdk1.5.0\jre\lib\jsse.jar;D:\jdk1.5.0\jre\lib\jce.jar;D:\jdk1.5.0\jre\lib\charsets.jar;D:\jdk1.5.0\jre\classes, java.vendor=Sun Microsystems Inc., file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=windows, sun.cpu.isalist=}
1131 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
1182 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
1182 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 4
1192 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
1202 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/test
1202 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=woodmawa, password=}
1202 [main] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - Running hbm2ddl schema update
1202 [main] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - fetching database metadata
1202 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - total checked-out connections: 0
1202 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - opening new JDBC connection
1562 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - created connection to: jdbc:mysql://localhost:3306/test, Isolation Level: 4
1582 [main] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - updating schema
1582 [main] INFO org.hibernate.cfg.Configuration - processing extends queue
1582 [main] INFO org.hibernate.cfg.Configuration - processing collection mappings
1582 [main] DEBUG org.hibernate.cfg.HbmBinder - Second pass for collection: tmp.Parent.children
1582 [main] INFO org.hibernate.cfg.HbmBinder - Mapping collection: tmp.Parent.children -> Child
1582 [main] DEBUG org.hibernate.cfg.HbmBinder - Mapped collection key: chd_parent, one-to-many: tmp.Child
1582 [main] INFO org.hibernate.cfg.Configuration - processing association property references
1582 [main] INFO org.hibernate.cfg.Configuration - processing foreign key constraints
1582 [main] DEBUG org.hibernate.cfg.Configuration - resolving reference to class: tmp.Parent
1622 [main] INFO org.hibernate.tool.hbm2ddl.TableMetadata - table found: .child
1622 [main] INFO org.hibernate.tool.hbm2ddl.TableMetadata - columns: [chd_parent, chd_uniquekey, chdid, chd_name, chd_version]
1632 [main] INFO org.hibernate.tool.hbm2ddl.TableMetadata - foreign keys: [fk3e104fc2a125cb]
1632 [main] INFO org.hibernate.tool.hbm2ddl.TableMetadata - indexes: [chd_uniquekey, primary, fk3e104fc2a125cb]
1672 [main] INFO org.hibernate.tool.hbm2ddl.TableMetadata - table found: .parent
1672 [main] INFO org.hibernate.tool.hbm2ddl.TableMetadata - columns: [par_name, par_version, parid, par_uniquekey]
1672 [main] INFO org.hibernate.tool.hbm2ddl.TableMetadata - foreign keys: []
1672 [main] INFO org.hibernate.tool.hbm2ddl.TableMetadata - indexes: [primary, par_uniquekey]
1722 [main] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - schema update complete
1722 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - cleaning up connection pool: jdbc:mysql://localhost:3306/test
1722 [main] DEBUG org.hibernate.cfg.Configuration - Preparing to build session factory with filters : {}
1722 [main] INFO org.hibernate.cfg.Configuration - processing extends queue
1722 [main] INFO org.hibernate.cfg.Configuration - processing collection mappings
1722 [main] INFO org.hibernate.cfg.Configuration - processing association property references
1722 [main] INFO org.hibernate.cfg.Configuration - processing foreign key constraints
1722 [main] DEBUG org.hibernate.cfg.Configuration - resolving reference to class: tmp.Parent
1732 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
1732 [main] DEBUG org.hibernate.exception.SQLExceptionConverterFactory - Using dialect defined converter
1732 [main] INFO org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 2
1732 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
1732 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
1732 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
1732 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
1742 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
1742 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
1742 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
1742 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 4
1742 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
1742 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/test
1742 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=woodmawa, password=}
1752 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - total checked-out connections: 0
1752 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - opening new JDBC connection
1792 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - created connection to: jdbc:mysql://localhost:3306/test, Isolation Level: 4
1802 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1
1802 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
1802 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
1802 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
1802 [main] DEBUG org.hibernate.cfg.SettingsFactory - Wrap result sets: disabled
1802 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled
1812 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
1812 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
1812 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
1812 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
1812 [main] INFO org.hibernate.cfg.SettingsFactory - Cache provider: org.hibernate.cache.HashtableCacheProvider
1822 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
1822 [main] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
1822 [main] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: enabled
1822 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
1822 [main] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
1822 [main] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
1822 [main] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
1822 [main] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
2083 [main] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
2083 [main] DEBUG org.hibernate.impl.SessionFactoryImpl - Session factory constructed with filter configurations : {}
2083 [main] DEBUG org.hibernate.impl.SessionFactoryImpl - instantiating session factory with properties: {hibernate.connection.password=, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, sun.boot.library.path=D:\jdk1.5.0\jre\bin, java.vm.version=1.5.0-b64, hibernate.connection.username=woodmawa, 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=GB, sun.os.patch.level=Service Pack 4, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\eclipse\workspace\hibernate\bin, java.runtime.version=1.5.0-b64, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=D:\jdk1.5.0\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=D:\DOCUME~1\woodmawa\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows 2000, sun.jnu.encoding=Cp1252, java.library.path=D:\jdk1.5.0\bin;.;C:\WINNT\system32;C:\WINNT;D:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;D:\Program Files\Rational\common;D:\Program Files\MySQL\MySQL Server 4.1\bin, java.specification.name=Java Platform API Specification, java.class.version=49.0, hibernate.connection.pool_size=4, sun.management.compiler=HotSpot Client Compiler, os.version=5.0, user.home=D:\Documents and Settings\woodmawa, user.timezone=, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.5, hibernate.connection.driver_class=com.mysql.jdbc.Driver, show_sql=true, user.name=woodmawa, java.class.path=D:\eclipse\workspace\hibernate\bin;D:\hibernate-3.0\hibernate3.jar;D:\hibernate-3.0\lib\xml-apis.jar;D:\hibernate-3.0\lib\ant-antlr-1.6.2.jar;D:\hibernate-3.0\lib\ant-junit-1.6.2.jar;D:\hibernate-3.0\lib\ant-launcher-1.6.2.jar;D:\hibernate-3.0\lib\antlr-2.7.4.jar;D:\hibernate-3.0\lib\ant-swing-1.6.2.jar;D:\hibernate-3.0\lib\c3p0-0.8.5.jar;D:\hibernate-3.0\lib\cglib-full-2.0.2.jar;D:\hibernate-3.0\lib\cleanimports.jar;D:\hibernate-3.0\lib\commons-collections-2.1.1.jar;D:\hibernate-3.0\lib\commons-logging-1.0.4.jar;D:\hibernate-3.0\lib\concurrent-1.3.2.jar;D:\hibernate-3.0\lib\connector.jar;D:\hibernate-3.0\lib\dom4j-1.5.2.jar;D:\hibernate-3.0\lib\ehcache-1.1.jar;D:\hibernate-3.0\lib\jaas.jar;D:\hibernate-3.0\lib\jacc-1_0-fr.jar;D:\hibernate-3.0\lib\jaxen-1.1-beta-4.jar;D:\hibernate-3.0\lib\jboss-cache.jar;D:\hibernate-3.0\lib\jboss-common.jar;D:\hibernate-3.0\lib\jboss-jmx.jar;D:\hibernate-3.0\lib\jboss-remoting.jar;D:\hibernate-3.0\lib\jboss-system.jar;D:\hibernate-3.0\lib\jdbc2_0-stdext.jar;D:\hibernate-3.0\lib\jgroups-2.2.7.jar;D:\hibernate-3.0\lib\jta.jar;D:\hibernate-3.0\lib\junit-3.8.1.jar;D:\hibernate-3.0\lib\log4j-1.2.9.jar;D:\hibernate-3.0\lib\oscache-2.1.jar;D:\hibernate-3.0\lib\proxool-0.8.3.jar;D:\hibernate-3.0\lib\swarmcache-1.0rc2.jar;D:\hibernate-3.0\lib\versioncheck.jar;D:\hibernate-3.0\lib\xerces-2.6.2.jar;D:\hibernate-3.0\lib\ant-1.6.2.jar;D:\downloads\Xdoclet\xdoclet-bin-1.2.2.zip, hibernate.show_sql=true, java.vm.specification.version=1.0, java.home=D:\jdk1.5.0\jre, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect, hibernate.connection.url=jdbc:mysql://localhost:3306/test, 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, sharing, java.version=1.5.0, java.ext.dirs=D:\jdk1.5.0\jre\lib\ext, sun.boot.class.path=D:\jdk1.5.0\jre\lib\rt.jar;D:\jdk1.5.0\jre\lib\i18n.jar;D:\jdk1.5.0\jre\lib\sunrsasign.jar;D:\jdk1.5.0\jre\lib\jsse.jar;D:\jdk1.5.0\jre\lib\jce.jar;D:\jdk1.5.0\jre\lib\charsets.jar;D:\jdk1.5.0\jre\classes, java.vendor=Sun Microsystems Inc., file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=windows, sun.cpu.isalist=}
2483 [main] DEBUG org.hibernate.util.ReflectHelper - reflection optimizer disabled for: tmp.Parent, BulkBeanException: Property is private (property setVersion)
2523 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Static SQL for entity: tmp.Parent
2523 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Version select: select par_version from Parent where parID =?
2523 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Snapshot select: select parent_.parID, parent_.par_version as par2_0_, parent_.par_name as par4_0_ from Parent parent_ where parent_.parID=?
2533 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Insert 0: insert into Parent (par_version, par_uniqueKey, par_name, parID) values (?, ?, ?, ?)
2533 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Update 0: update Parent set par_version=?, par_name=? where parID=? and par_version=?
2533 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Delete 0: delete from Parent where parID=? and par_version=?
2694 [Finalizer] INFO org.hibernate.connection.DriverManagerConnectionProvider - cleaning up connection pool: jdbc:mysql://localhost:3306/test
2724 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Static SQL for entity: tmp.Child
2724 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Version select: select chd_version from Child where chdID =?
2724 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Snapshot select: select child_.chdID, child_.chd_version as chd2_1_, child_.chd_name as chd4_1_, child_.chd_parent as chd5_1_ from Child child_ where child_.chdID=?
2724 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Insert 0: insert into Child (chd_version, chd_uniqueKey, chd_name, chd_parent, chdID) values (?, ?, ?, ?, ?)
2724 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Update 0: update Child set chd_version=?, chd_name=?, chd_parent=? where chdID=? and chd_version=?
2734 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Delete 0: delete from Child where chdID=? and chd_version=?
2744 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Static SQL for collection: tmp.Parent.children
2744 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row insert: update Child set chd_parent=? where chdID=?
2744 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row delete: update Child set chd_parent=null where chdID=?
2744 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - One-shot delete: update Child set chd_parent=null where chd_parent=?
2774 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity tmp.Parent: select parent0_.parID as parID0_, parent0_.par_version as par2_0_0_, parent0_.par_uniqueKey as par3_0_0_, parent0_.par_name as par4_0_0_ from Parent parent0_ where parent0_.parID=?
2774 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity tmp.Parent: select parent0_.parID as parID0_, parent0_.par_version as par2_0_0_, parent0_.par_uniqueKey as par3_0_0_, parent0_.par_name as par4_0_0_ from Parent parent0_ where parent0_.parID=?
2774 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity tmp.Parent: select parent0_.parID as parID0_, parent0_.par_version as par2_0_0_, parent0_.par_uniqueKey as par3_0_0_, parent0_.par_name as par4_0_0_ from Parent parent0_ where parent0_.parID=? for update
2774 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity tmp.Parent: select parent0_.parID as parID0_, parent0_.par_version as par2_0_0_, parent0_.par_uniqueKey as par3_0_0_, parent0_.par_name as par4_0_0_ from Parent parent0_ where parent0_.parID=? for update
2774 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity tmp.Child: select child0_.chdID as chdID0_, child0_.chd_version as chd2_1_0_, child0_.chd_uniqueKey as chd3_1_0_, child0_.chd_name as chd4_1_0_, child0_.chd_parent as chd5_1_0_ from Child child0_ where child0_.chdID=?
2774 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity tmp.Child: select child0_.chdID as chdID0_, child0_.chd_version as chd2_1_0_, child0_.chd_uniqueKey as chd3_1_0_, child0_.chd_name as chd4_1_0_, child0_.chd_parent as chd5_1_0_ from Child child0_ where child0_.chdID=?
2774 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity tmp.Child: select child0_.chdID as chdID0_, child0_.chd_version as chd2_1_0_, child0_.chd_uniqueKey as chd3_1_0_, child0_.chd_name as chd4_1_0_, child0_.chd_parent as chd5_1_0_ from Child child0_ where child0_.chdID=? for update
2784 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity tmp.Child: select child0_.chdID as chdID0_, child0_.chd_version as chd2_1_0_, child0_.chd_uniqueKey as chd3_1_0_, child0_.chd_name as chd4_1_0_, child0_.chd_parent as chd5_1_0_ from Child child0_ where child0_.chdID=? for update
2794 [main] DEBUG org.hibernate.loader.collection.OneToManyLoader - Static select for one-to-many tmp.Parent.children: select children0_.chd_parent as chd5___, children0_.chdID as chdID__, children0_.chdID as chdID0_, children0_.chd_version as chd2_1_0_, children0_.chd_uniqueKey as chd3_1_0_, children0_.chd_name as chd4_1_0_, children0_.chd_parent as chd5_1_0_ from Child children0_ where children0_.chd_parent=?
2794 [main] DEBUG org.hibernate.impl.SessionFactoryObjectFactory - initializing class SessionFactoryObjectFactory
2794 [main] DEBUG org.hibernate.impl.SessionFactoryObjectFactory - registered: 8aeea19602aa98560102aa985a8d0000 (unnamed)
2824 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
2824 [main] DEBUG org.hibernate.impl.SessionFactoryImpl - instantiated session factory
2824 [main] INFO org.hibernate.impl.SessionFactoryImpl - Checking 0 named queries
2884 [main] DEBUG org.hibernate.impl.SessionImpl - opened session
2884 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - saving transient instance
2884 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - opening JDBC connection
2884 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - total checked-out connections: 0
2884 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - using pooled JDBC connection, pool size: 0
2884 [main] DEBUG org.hibernate.id.IncrementGenerator - fetching initial value: select max(chdID) from Child
2904 [main] DEBUG org.hibernate.id.IncrementGenerator - first free id: 1
2914 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - generated identifier: 1, using strategy: org.hibernate.id.IncrementGenerator
2914 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - saving [tmp.Child#1]
2944 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: tmp.Child
2944 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: tmp.Parent
2944 [main] DEBUG org.hibernate.engine.Cascades - version unsaved-value strategy UNDEFINED
2944 [main] DEBUG org.hibernate.engine.Cascades - id unsaved-value: 0
2944 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - transient instance of: tmp.Parent
2944 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - saving transient instance
2944 [main] DEBUG org.hibernate.id.IncrementGenerator - fetching initial value: select max(parID) from Parent
2954 [main] DEBUG org.hibernate.id.IncrementGenerator - first free id: 1
2954 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - generated identifier: 1, using strategy: org.hibernate.id.IncrementGenerator
2954 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - saving [tmp.Parent#1]
2954 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: tmp.Parent
2964 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: tmp.Parent
2964 [main] DEBUG org.hibernate.engine.Versioning - using initial version: 0
2984 [main] DEBUG org.hibernate.event.def.WrapVisitor - Wrapped collection in role: tmp.Parent.children
2994 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: tmp.Parent
2994 [main] DEBUG org.hibernate.engine.Cascades - cascade ACTION_SAVE_UPDATE for collection: tmp.Parent.children
2994 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: tmp.Child
2994 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: tmp.Child
2994 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
3004 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [tmp.Child#1]
3004 [main] DEBUG org.hibernate.engine.Cascades - done cascade ACTION_SAVE_UPDATE for collection: tmp.Parent.children
3004 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: tmp.Parent
3004 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: tmp.Child
3004 [main] DEBUG org.hibernate.engine.Versioning - using initial version: 0
3004 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: tmp.Child
3004 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: tmp.Child
3014 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - flushing session
3014 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - processing flush-time cascades
3014 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: tmp.Parent
3014 [main] DEBUG org.hibernate.engine.Cascades - cascade ACTION_SAVE_UPDATE for collection: tmp.Parent.children
3014 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: tmp.Child
3014 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: tmp.Child
3014 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
3014 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [tmp.Child#1]
3014 [main] DEBUG org.hibernate.engine.Cascades - done cascade ACTION_SAVE_UPDATE for collection: tmp.Parent.children
3014 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: tmp.Parent
3014 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: tmp.Child
3014 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: tmp.Parent
3014 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: tmp.Parent
3014 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
3014 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [tmp.Parent#1]
3024 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: tmp.Child
3024 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - dirty checking collections
3024 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushing entities and processing referenced collections
3034 [main] DEBUG org.hibernate.engine.Collections - Collection found: [tmp.Parent.children#1], was: [<unreferenced>] (initialized)
3034 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Processing unreferenced collections
3034 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Scheduling collection removes/(re)creates/updates
3034 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 2 insertions, 0 updates, 0 deletions to 2 objects
3034 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 1 (re)creations, 0 updates, 0 removals to 1 collections
3054 [main] DEBUG org.hibernate.pretty.Printer - listing entities:
3054 [main] DEBUG org.hibernate.pretty.Printer - tmp.Child{key=8507107030974127986, chdID=1, name=Tobias, parent=tmp.Parent#1, version=0}
3064 [main] DEBUG org.hibernate.pretty.Printer - tmp.Parent{key=8507107030974127986, parID=1, name=mum, children=[tmp.Child#1], version=0}
3064 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - executing flush
3064 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Inserting entity: [tmp.Parent#1]
3064 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Version: 0
3064 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
3064 [main] DEBUG org.hibernate.SQL - insert into Parent (par_version, par_uniqueKey, par_name, parID) values (?, ?, ?, ?)
Hibernate: insert into Parent (par_version, par_uniqueKey, par_name, parID) values (?, ?, ?, ?)
3064 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement
3074 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Dehydrating entity: [tmp.Parent#1]
3074 [main] DEBUG org.hibernate.type.IntegerType - binding '0' to parameter: 1
3074 [main] DEBUG org.hibernate.type.LongType - binding '8507107030974127986' to parameter: 2
3074 [main] DEBUG org.hibernate.type.StringType - binding 'mum' to parameter: 3
3074 [main] DEBUG org.hibernate.type.LongType - binding '1' to parameter: 4
3074 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - Adding to batch
3074 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Inserting entity: [tmp.Child#1]
3084 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Version: 0
3084 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - Executing batch size: 1
3084 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
3084 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - closing statement
3084 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
3084 [main] DEBUG org.hibernate.SQL - insert into Child (chd_version, chd_uniqueKey, chd_name, chd_parent, chdID) values (?, ?, ?, ?, ?)
Hibernate: insert into Child (chd_version, chd_uniqueKey, chd_name, chd_parent, chdID) values (?, ?, ?, ?, ?)
3094 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement
3094 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Dehydrating entity: [tmp.Child#1]
3094 [main] DEBUG org.hibernate.type.IntegerType - binding '0' to parameter: 1
3094 [main] DEBUG org.hibernate.type.LongType - binding '8507107030974127986' to parameter: 2
3094 [main] DEBUG org.hibernate.type.StringType - binding 'Tobias' to parameter: 3
3094 [main] DEBUG org.hibernate.type.LongType - binding '1' to parameter: 4
3094 [main] DEBUG org.hibernate.type.LongType - binding '1' to parameter: 5
3104 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - Adding to batch
3104 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - Executing batch size: 1
3104 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
3104 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - closing statement
3104 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - post flush
3104 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - flushing session
3104 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - processing flush-time cascades
3104 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: tmp.Parent
3104 [main] DEBUG org.hibernate.engine.Cascades - cascade ACTION_SAVE_UPDATE for collection: tmp.Parent.children
3104 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: tmp.Child
3104 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: tmp.Child
3104 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
3104 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [tmp.Child#1]
3114 [main] DEBUG org.hibernate.engine.Cascades - done cascade ACTION_SAVE_UPDATE for collection: tmp.Parent.children
3114 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: tmp.Parent
3114 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: tmp.Child
3114 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: tmp.Parent
3114 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: tmp.Parent
3114 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
3114 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [tmp.Parent#1]
3114 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: tmp.Child
3114 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - dirty checking collections
3114 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushing entities and processing referenced collections
3114 [main] DEBUG org.hibernate.engine.Collections - Collection found: [tmp.Parent.children#1], was: [tmp.Parent.children#1] (initialized)
3114 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Processing unreferenced collections
3114 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Scheduling collection removes/(re)creates/updates
3114 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 0 insertions, 0 updates, 0 deletions to 2 objects
3124 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 0 removals to 1 collections
3124 [main] DEBUG org.hibernate.pretty.Printer - listing entities:
3124 [main] DEBUG org.hibernate.pretty.Printer - tmp.Child{key=8507107030974127986, chdID=1, name=Tobias, parent=tmp.Parent#1, version=0}
3124 [main] DEBUG org.hibernate.pretty.Printer - tmp.Parent{key=8507107030974127986, parID=1, name=mum, children=[tmp.Child#1], version=0}
3124 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - executing flush
3124 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - post flush
3124 [main] DEBUG org.hibernate.impl.SessionImpl - closing session
3124 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - closing JDBC connection (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)
3124 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1
3124 [main] DEBUG org.hibernate.jdbc.JDBCContext - after transaction completion
3134 [main] DEBUG org.hibernate.impl.SessionImpl - after transaction completion
Debug level Hibernate log excerpt: mapped classes :parent class
Code:
public class Parent
{
static Logger logger = Logger.getLogger(Parent.class);
protected long parID; //DB pkey column
protected long _key; // internal unique _key
protected String name;
protected String description;
protected int version;
protected Set<Child> children = new HashSet<Child>();
/**
*
*/
public Parent ()
{
InetAddress me;
try
{
me = InetAddress.getLocalHost();
}
catch (UnknownHostException e)
{
logger.error("Error getting InetAddress for local client " + e.getMessage());
throw new RuntimeException (e);
}
//build a unique _key for the element
//the data base id wont get set until a commit happens
_key = Math.abs(System.currentTimeMillis()* me.hashCode());
}
public Parent (String name)
{
this (); //call default constructor
setName(name);
}
/**
* @return Returns the business natural test of equality.
*/
public boolean equals (Object other)
{
if (this == other) return true;
//if not in class hierarchy
if (! (other instanceof Parent)) return false;
final Parent prodType = (Parent) other; //safe cast
if (this._key != prodType._key) return false;
if (!prodType.getName().equals(name)) return false;
return true;
}
/**
* @return Returns hash based on business _key not the id.
*/
public int hashCode ()
{
int result;
result = 29 *(int)_key;
return result;
}
/**
* @return Returns the _key.
*/
public long getKey()
{
return _key;
}
/**
* @param _key The _key to set.
*/
private void setKey(long key)
{
this._key = key;
}
/**
* @return Returns the description.
*/
public String getDescription()
{
return description;
}
/**
* @param description The description to set.
*/
public void setDescription(String description)
{
this.description = description;
}
/**
* @return Returns the name.
*/
public String getName()
{
return name;
}
/**
* @param name The name to set.
*/
public void setName(String name)
{
this.name = name;
}
/**
* @return Returns the prtID.
*/
public long getParID()
{
return parID;
}
/**
* @param prtID The prtID to set.
*/
private void setParID(long prtID)
{
this.parID = prtID;
}
/**
* @return Returns the version.
*/
public int getVersion()
{
return version;
}
/**
* @param version The version to set.
*/
private void setVersion(int version)
{
this.version = version;
}
/**
* @return Returns the subCategories.
*/
private Set<Child> getChildren()
{
return children;
}
/**
* @param subCategories The subCategories to set.
*/
private void setChildren(Set<Child> children)
{
this.children = children;
}
/**
* adds a new sub category to the child list
*
* @param sub - The sub ProductCategory to set.
*/
public boolean addChild(Child child)
{
// force the update from the dependent self join
child.setParent(this);
return this.children.add(child);
}
/**
* @param sub The ProductCategory to set.
*/
public boolean removeParent(Child child)
{
if (this.children == null)
return false;
if (!this.children.contains(child))
return false;
else
return this.children.remove(child);
}
}
and then the child class
Code:
public class Child
{
static Logger logger = Logger.getLogger(Child.class);
protected long chdID; //DB pkey column
protected long _key; // internal unique _key
protected String name;
protected Date launchedDate;
protected Date withdrawnDate;
protected String status;
protected int version;
protected Parent parent;
public Child ()
{
InetAddress me;
try
{
me = InetAddress.getLocalHost();
}
catch (UnknownHostException e)
{
logger.error("Error getting InetAddress for local client " + e.getMessage());
throw new RuntimeException (e);
}
//build a unique _key for the element
//the data base id wont get set until a commit happens
_key = Math.abs(System.currentTimeMillis()* me.hashCode());
}
public Child (String name)
{
this (); //call default constructor
setName(name);
}
/**
* @return Returns the business natural test of equality.
*/
public boolean equals (Object other)
{
if (this == other) return true;
//if not in class hierarchy
if (! (other instanceof Child)) return false;
final Child cust = (Child) other; //safe cast
if (this._key != cust._key) return false;
if (!cust.getName().equals(name)) return false;
return true;
}
/**
* @return Returns hash based on business _key not the id.
*/
public int hashCode ()
{
int result;
result = 29 *(int)_key;
return result;
}
/**
* @return Returns the launchedDate.
*/
public Date getLaunchedDate()
{
return launchedDate;
}
/**
* @param launchedDate The launchedDate to set.
*/
public void setLaunchedDate(Date launchedDate)
{
this.launchedDate = launchedDate;
}
/**
* @return Returns the status.
*/
public String getStatus()
{
return status;
}
/**
* @param status The status to set.
*/
public void setStatus(String status)
{
this.status = status;
}
/**
* @return Returns the withdrawnDate.
*/
public Date getWithdrawnDate()
{
return withdrawnDate;
}
/**
* @param withdrawnDate The withdrawnDate to set.
*/
public void setWithdrawnDate(Date withdrawnDate)
{
this.withdrawnDate = withdrawnDate;
}
/**
* @return Returns the _key.
*/
public long getKey()
{
return _key;
}
/**
* @param _key The _key to set.
*/
protected void setKey(long key)
{
this._key = key;
}
/**
* @return Returns the name.
*/
public String getName()
{
return name;
}
/**
* @param name The name to set.
*/
public void setName(String name)
{
this.name = name;
}
/**
* @return Returns the prdID.
*/
public long getChdID()
{
return chdID;
}
/**
* @param prdID The prdID to set.
*/
protected void setChdID(long prdID)
{
this.chdID = prdID;
}
/**
* @return Returns the productType.
*/
public Parent getParent()
{
return parent;
}
/**
* @param productType The productType to set.
*/
public void setParent(Parent par)
{
this.parent = par;
}
/**
* @return Returns the version.
*/
public int getVersion()
{
return version;
}
/**
* @param version The version to set.
*/
protected void setVersion(int version)
{
this.version = version;
}