OK, Here goes:
Code:
package hibtest;
import java.util.Iterator;
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.Configuration;
public class HibTest {
public static void main(String[] args) throws HibernateException {
SessionFactory sf = new Configuration().configure().buildSessionFactory();
Session session = sf.openSession();
Transaction tx = session.beginTransaction();
System.out.println("Get Foo");
Foo foo = (Foo)session.load(Foo.class, new Long(10853));
System.out.println("Initialize Bars");
Hibernate.initialize(foo.getBars());
// Iterator it = foo.getBars().iterator();
// while (it.hasNext()) {
// Bar bar = (Bar)it.next();
// Hibernate.initialize(bar.getSubs());
// }
tx.commit();
session.close();
System.out.println("Changing Foo");
System.out.println("Session2");
Session session2 = sf.openSession();
Transaction tx2 = session2.beginTransaction();
System.out.println("Doing reattach");
session2.saveOrUpdateCopy(foo);
tx2.commit();
session2.close();
}
}
package hibtest;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
public class Foo implements Serializable {
private Long id;
private Integer version;
private String fooNumber;
private Set bars = new HashSet();
public Foo() {
}
public Long getId() {
return id;
}
public Integer getVersion() {
return version;
}
public String getFooNumber() {
return fooNumber;
}
public void setFooNumber(String fooNumber) {
this.fooNumber = fooNumber;
}
public Set getBars() {
return bars;
}
public boolean equals(Object obj) {
if (obj == null || !obj.getClass().equals(getClass())) {
return false;
}
Foo foo2 = (Foo)obj;
return foo2.fooNumber.equals(fooNumber);
}
public int hashCode() {
return fooNumber.hashCode();
}
}
package hibtest;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
public class Bar implements Serializable {
private Long id;
private Integer version;
private Set subs = new HashSet();
public Bar() {
}
public Long getId() {
return id;
}
public Integer getVersion() {
return version;
}
public Set getSubs() {
return subs;
}
public boolean equals(Object obj) {
if (obj == null || !obj.getClass().equals(getClass())) {
return false;
}
Bar bar2 = (Bar)obj;
return bar2.id.equals(id);
}
public int hashCode() {
return id.hashCode();
}
}
package hibtest;
import java.io.Serializable;
public class Sub implements Serializable {
private String id;
private String descEng;
private String descFre;
private Sub() {
}
public String getId() {
return id;
}
public String getDescEng() {
return descEng;
}
public String getDescFre() {
return descFre;
}
public boolean equals(Object obj) {
if (obj == null || !obj.getClass().equals(getClass())) {
return false;
}
Sub sub2 = (Sub)obj;
return id.equals(sub2.id);
}
public int hashCode() {
return id.hashCode();
}
}
Mapping files:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping SYSTEM
"file:///C:/hibernate-2.1/src/net/sf/hibernate/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="hibtest">
<class name="Foo" table="incident">
<id name="id" access="field" type="long" column="incident_id">
<generator class="native">
<param name="sequence">GENERIC_PK_SEQ</param>
</generator>
</id>
<version name="version" column="version" access="field" type="integer" unsaved-value="null"/>
<property name="fooNumber" access="field" column="incident_number"
type="string" length="10" not-null="true" unique="true"/>
<set name="bars" access="field" lazy="true" cascade="all">
<key column="incident_id"/>
<one-to-many class="Bar"/>
</set>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping SYSTEM
"file:///C:/hibernate-2.1/src/net/sf/hibernate/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="hibtest">
<class name="Bar" table="persons_involved" dynamic-update="true">
<id name="id" access="field" type="long" column="person_id">
<generator class="native">
<param name="sequence">GENERIC_PK_SEQ</param>
</generator>
</id>
<version name="version" column="version" access="field" type="integer" unsaved-value="null"/>
<set name="subs" access="field" lazy="true" table="incident_role"
cascade="all">
<key column="person_id"/>
<many-to-many class="Sub" column="incident_role_code"/>
</set>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping SYSTEM
"file:///C:/hibernate-2.1/src/net/sf/hibernate/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="hibtest">
<class name="Sub" table="incident_role_type" mutable="false">
<cache usage="read-only"/>
<id name="id" access="field" type="string" column="incident_role_code">
<generator class="assigned"/>
</id>
<property name="descEng" access="field" column="desc_e" type="string"
length="30"/>
<property name="descFre" access="field" column="desc_f" type="string"
length="30"/>
</class>
</hibernate-mapping>
Config files:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration SYSTEM
"file:///C:/hibernate-2.1/src/net/sf/hibernate/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.username">security</property>
<property name="hibernate.connection.password">security1</property>
<property name="hibernate.connection.url">
jdbc:oracle:thin:@L10062.dev-eng:1532:omsp</property>
<property name="hibernate.connection.driver_class">
oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.transaction.factory_class">
net.sf.hibernate.transaction.JDBCTransactionFactory </property>
<property name="hibernate.dialect">
net.sf.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.connection.pool_size">30</property>
<property name="hibernate.show_sql">true</property>
<!-- Apache DBCP (connection pool) configuration -->
<property name="hibernate.dbcp.maxActive">100</property>
<property name="hibernate.dbcp.whenExhaustedAction">1</property>
<property name="hibernate.dbcp.maxWait">120000</property>
<property name="hibernate.dbcp.maxIdle">10</property>
<property name="hibernate.dbcp.ps.maxActive">100</property>
<property name="hibernate.dbcp.ps.whenExhaustedAction">1</property>
<property name="hibernate.dbcp.ps.maxWait">120000</property>
<property name="hibernate.dbcp.ps.maxIdle">10</property>
<property name="hibernate.dbcp.validationQuery">select 1 from
dual</property>
<property name="hibernate.dbcp.testOnBorrow">true</property>
<property name="hibernate.dbcp.testOnReturn">false</property>
<property name="hibernate.connection.provider_class">
net.sf.hibernate.connection.DBCPConnectionProvider</property>
<!-- Cache -->
<property name="hibernate.cache.provider_class">
net.sf.ehcache.hibernate.Provider</property>
<!-- Mapping files -->
<mapping resource="hibtest/Foo.hbm.xml"/>
<mapping resource="hibtest/Sub.hbm.xml"/>
<mapping resource="hibtest/Bar.hbm.xml"/>
</session-factory>
</hibernate-configuration>
EHCache:
Code:
<ehcache>
<!-- Sets the path to the directory where cache .data files are created.
If the path is a Java System Property it is replaced by
its value in the running VM.
The following properties are translated:
user.home - User's home directory
user.dir - User's current working directory
java.io.tmpdir - Default temp file path -->
<diskStore path="java.io.tmpdir"/>
<!--Default Cache configuration. These will applied to caches programmatically created through
the CacheManager.
The following attributes are required for defaultCache:
maxInMemory - Sets the maximum number of objects that will be created in memory
eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the element
is never expired.
timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
if the element is not eternal. Idle time is now - last accessed time
timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
if the element is not eternal. TTL is now - creation time
overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache
has reached the maxInMemory limit.
-->
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
/>
<!--Predefined caches. Add your cache configuration settings here.
If you do not have a configuration for your cache a WARNING will be issued when the
CacheManager starts
The following attributes are required for defaultCache:
name - Sets the name of the cache. This is used to identify the cache. It must be unique.
maxInMemory - Sets the maximum number of objects that will be created in memory
eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the element
is never expired.
timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
if the element is not eternal. Idle time is now - last accessed time
timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
if the element is not eternal. TTL is now - creation time
overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache
has reached the maxInMemory limit.
-->
<!-- Place configuration for your caches following -->
<cache name="hibtest.Sub"
maxElementsInMemory="8"
eternal="true"
timeToIdleSeconds="0"
timeToLiveSeconds="0"
overflowToDisk="false"
/>
</ehcache>
Output:
Code:
14:18:23,202 INFO Environment:462 - Hibernate 2.1.4
14:18:23,202 INFO Environment:491 - hibernate.properties not found
14:18:23,212 INFO Environment:522 - using CGLIB reflection optimizer
14:18:23,212 INFO Configuration:872 - configuring from resource: /hibernate.cfg.xml
14:18:23,212 INFO Configuration:844 - Configuration resource: /hibernate.cfg.xml
14:18:23,332 DEBUG Configuration:830 - hibernate.connection.username=security
14:18:23,332 DEBUG Configuration:830 - hibernate.connection.password=security1
14:18:23,332 DEBUG Configuration:830 - hibernate.connection.url=jdbc:oracle:thin:@L10062.dev-eng:1532:omsp
14:18:23,332 DEBUG Configuration:830 - hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
14:18:23,332 DEBUG Configuration:830 - hibernate.transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory
14:18:23,342 DEBUG Configuration:830 - hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect
14:18:23,342 DEBUG Configuration:830 - hibernate.connection.pool_size=30
14:18:23,342 DEBUG Configuration:830 - hibernate.show_sql=true
14:18:23,342 DEBUG Configuration:830 - hibernate.dbcp.maxActive=100
14:18:23,342 DEBUG Configuration:830 - hibernate.dbcp.whenExhaustedAction=1
14:18:23,342 DEBUG Configuration:830 - hibernate.dbcp.maxWait=120000
14:18:23,342 DEBUG Configuration:830 - hibernate.dbcp.maxIdle=10
14:18:23,342 DEBUG Configuration:830 - hibernate.dbcp.ps.maxActive=100
14:18:23,342 DEBUG Configuration:830 - hibernate.dbcp.ps.whenExhaustedAction=1
14:18:23,342 DEBUG Configuration:830 - hibernate.dbcp.ps.maxWait=120000
14:18:23,352 DEBUG Configuration:830 - hibernate.dbcp.ps.maxIdle=10
14:18:23,352 DEBUG Configuration:830 - hibernate.dbcp.validationQuery=select 1 from
dual
14:18:23,352 DEBUG Configuration:830 - hibernate.dbcp.testOnBorrow=true
14:18:23,362 DEBUG Configuration:830 - hibernate.dbcp.testOnReturn=false
14:18:23,362 DEBUG Configuration:830 - hibernate.connection.provider_class=net.sf.hibernate.connection.DBCPConnectionProvider
14:18:23,362 DEBUG Configuration:830 - hibernate.cache.provider_class=net.sf.ehcache.hibernate.Provider
14:18:23,362 DEBUG Configuration:989 - null<-org.dom4j.tree.DefaultAttribute@1d2068d [Attribute: name resource value "hibtest/Foo.hbm.xml"]
14:18:23,362 INFO Configuration:328 - Mapping resource: hibtest/Foo.hbm.xml
14:18:23,462 INFO Binder:229 - Mapping class: hibtest.Foo -> incident
14:18:23,532 DEBUG Binder:475 - Mapped property: id -> incident_id, type: long
14:18:23,532 DEBUG Binder:475 - Mapped property: version -> version, type: integer
14:18:23,542 DEBUG Binder:475 - Mapped property: fooNumber -> incident_number, type: string
14:18:23,562 DEBUG Binder:475 - Mapped property: bars, type: java.util.Set
14:18:23,562 DEBUG Configuration:989 - null<-org.dom4j.tree.DefaultAttribute@37fb1e [Attribute: name resource value "hibtest/Sub.hbm.xml"]
14:18:23,572 INFO Configuration:328 - Mapping resource: hibtest/Sub.hbm.xml
14:18:23,592 INFO Binder:229 - Mapping class: hibtest.Sub -> incident_role_type
14:18:23,602 DEBUG CacheFactory:32 - cache for: hibtest.Sub usage strategy: read-only
14:18:23,602 DEBUG Binder:475 - Mapped property: id -> incident_role_code, type: string
14:18:23,602 DEBUG Binder:475 - Mapped property: descEng -> desc_e, type: string
14:18:23,602 DEBUG Binder:475 - Mapped property: descFre -> desc_f, type: string
14:18:23,612 DEBUG Configuration:989 - null<-org.dom4j.tree.DefaultAttribute@1fc2fb [Attribute: name resource value "hibtest/Bar.hbm.xml"]
14:18:23,612 INFO Configuration:328 - Mapping resource: hibtest/Bar.hbm.xml
14:18:23,622 INFO Binder:229 - Mapping class: hibtest.Bar -> persons_involved
14:18:23,622 DEBUG Binder:475 - Mapped property: id -> person_id, type: long
14:18:23,622 DEBUG Binder:475 - Mapped property: version -> version, type: integer
14:18:23,632 INFO Binder:560 - Mapping collection: hibtest.Bar.subs -> incident_role
14:18:23,632 DEBUG Binder:475 - Mapped property: subs, type: java.util.Set
14:18:23,632 INFO Configuration:1030 - Configured SessionFactory: null
14:18:23,632 DEBUG Configuration:1031 - properties: {java.vendor=Sun Microsystems Inc., hibernate.connection.url=jdbc:oracle:thin:@L10062.dev-eng:1532:omsp, hibernate.dbcp.ps.maxWait=120000, os.name=Windows XP, sun.boot.class.path=C:\j2sdk1.4.2\jre\lib\rt.jar;C:\j2sdk1.4.2\jre\lib\i18n.jar;C:\j2sdk1.4.2\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2\jre\lib\jsse.jar;C:\j2sdk1.4.2\jre\lib\jce.jar;C:\j2sdk1.4.2\jre\lib\charsets.jar;C:\j2sdk1.4.2\jre\classes, hibernate.dbcp.maxWait=120000, sun.java2d.fontpath=, java.vm.specification.vendor=Sun Microsystems Inc., java.runtime.version=1.4.2-b28, hibernate.cache.provider_class=net.sf.ehcache.hibernate.Provider, user.name=wrightdavi, hibernate.dbcp.ps.maxIdle=10, hibernate.dbcp.maxActive=100, hibernate.dbcp.maxIdle=10, user.language=en, sun.boot.library.path=C:\j2sdk1.4.2\jre\bin, java.version=1.4.2, user.timezone=America/New_York, sun.arch.data.model=32, java.endorsed.dirs=C:\j2sdk1.4.2\jre\lib\endorsed, sun.cpu.isalist=pentium i486 i386, file.encoding.pkg=sun.io, file.separator=\, java.specification.name=Java Platform API Specification, hibernate.cglib.use_reflection_optimizer=true, java.class.version=48.0, user.country=CA, java.home=C:\j2sdk1.4.2\jre, hibernate.dbcp.whenExhaustedAction=1, java.vm.info=mixed mode, hibernate.dbcp.ps.whenExhaustedAction=1, os.version=5.1, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory, path.separator=;, java.vm.version=1.4.2-b28, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, hibernate.connection.password=security1, user.variant=, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, hibernate.connection.username=security, user.home=C:\Documents and Settings\WrightDAVI, java.specification.vendor=Sun Microsystems Inc., hibernate.dbcp.ps.maxActive=100, java.library.path=C:\j2sdk1.4.2\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\oracle\ora8i\bin;C:\Program Files\Oracle\jre\1.1.7\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\oracle\Ora92\Olap\XSA632;C:\Program Files\Rational\common;C:\Program Files\Rational\ClearCase\bin;c:\j2sdk1.4.2\bin, java.vendor.url=http://java.sun.com/, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, java.class.path=C:\eclipse\workspace\TestHib\bin;C:\hibernate-2.1\hibernate2.jar;C:\hibernate-2.1\lib\odmg-3.0.jar;C:\hibernate-2.1\lib\cglib-full-2.0.1.jar;C:\hibernate-2.1\lib\commons-collections-2.1.jar;C:\hibernate-2.1\lib\commons-dbcp-1.1.jar;C:\hibernate-2.1\lib\commons-logging-1.0.3.jar;C:\hibernate-2.1\lib\commons-pool-1.1.jar;C:\hibernate-2.1\lib\dom4j-1.4.jar;C:\hibernate-2.1\lib\ehcache-0.7.jar;C:\hibernate-2.1\lib\jdbc2_0-stdext.jar;C:\jdev9052\jdbc\lib\nls_charset12.jar;C:\jdev9052\jdbc\lib\classes12.jar;C:\jdev9052\j2ee\home\lib\jta.jar;C:\jakarta-log4j-1.2.8\dist\lib\log4j-1.2.8.jar, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, hibernate.dbcp.testOnReturn=false, sun.cpu.endian=little, sun.os.patch.level=Service Pack 1, hibernate.connection.provider_class=net.sf.hibernate.connection.DBCPConnectionProvider, java.io.tmpdir=C:\DOCUME~1\WRIGHT~1\LOCALS~1\Temp\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, hibernate.dbcp.validationQuery=select 1 from
dual, os.arch=x86, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, hibernate.dbcp.testOnBorrow=true, java.ext.dirs=C:\j2sdk1.4.2\jre\lib\ext, user.dir=C:\eclipse\workspace\TestHib, line.separator=
, java.vm.name=Java HotSpot(TM) Client VM, file.encoding=Cp1252, java.specification.version=1.4, hibernate.show_sql=true, hibernate.connection.pool_size=30}
14:18:23,632 INFO Configuration:613 - processing one-to-many association mappings
14:18:23,632 DEBUG Binder:1340 - Second pass for collection: hibtest.Foo.bars
14:18:23,632 INFO Binder:1168 - Mapping collection: hibtest.Foo.bars -> persons_involved
14:18:23,632 DEBUG Binder:1355 - Mapped collection key: incident_id, one-to-many: hibtest.Bar
14:18:23,642 DEBUG Binder:1340 - Second pass for collection: hibtest.Bar.subs
14:18:23,642 DEBUG Binder:1355 - Mapped collection key: person_id, element: incident_role_code, type: hibtest.Sub
14:18:23,642 INFO Configuration:622 - processing one-to-one association property references
14:18:23,642 INFO Configuration:647 - processing foreign key constraints
14:18:23,642 DEBUG Configuration:657 - resolving reference to class: hibtest.Foo
14:18:23,642 DEBUG Configuration:657 - resolving reference to class: hibtest.Sub
14:18:23,642 DEBUG Configuration:657 - resolving reference to class: hibtest.Bar
14:18:23,692 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.Oracle9Dialect
14:18:23,692 INFO SettingsFactory:62 - Use outer join fetching: true
14:18:23,692 INFO ConnectionProviderFactory:53 - Initializing connection provider: net.sf.hibernate.connection.DBCPConnectionProvider
14:18:23,702 INFO DBCPConnectionProvider:56 - DBCP using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@L10062.dev-eng:1532:omsp
14:18:23,702 INFO DBCPConnectionProvider:57 - Connection properties: {user=security, password=security1}
14:18:23,802 INFO DBCPConnectionProvider:94 - DBCP prepared statement pooling enabled
14:18:23,812 INFO TransactionFactoryFactory:31 - Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
14:18:23,822 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
14:18:25,725 INFO SettingsFactory:102 - Use scrollable result sets: true
14:18:25,725 INFO SettingsFactory:105 - Use JDBC3 getGeneratedKeys(): false
14:18:25,725 INFO SettingsFactory:108 - Optimize cache for minimal puts: false
14:18:25,735 INFO SettingsFactory:114 - echoing all SQL to stdout
14:18:25,735 INFO SettingsFactory:117 - Query language substitutions: {}
14:18:25,735 INFO SettingsFactory:128 - cache provider: net.sf.ehcache.hibernate.Provider
14:18:25,735 INFO Configuration:1093 - instantiating and configuring caches
14:18:25,735 DEBUG Configuration:1104 - instantiating cache hibtest.Sub
14:18:25,885 INFO SessionFactoryImpl:119 - building session factory
14:18:25,885 DEBUG SessionFactoryImpl:125 - instantiating session factory with properties: {java.vendor=Sun Microsystems Inc., hibernate.connection.url=jdbc:oracle:thin:@L10062.dev-eng:1532:omsp, hibernate.dbcp.ps.maxWait=120000, os.name=Windows XP, sun.boot.class.path=C:\j2sdk1.4.2\jre\lib\rt.jar;C:\j2sdk1.4.2\jre\lib\i18n.jar;C:\j2sdk1.4.2\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2\jre\lib\jsse.jar;C:\j2sdk1.4.2\jre\lib\jce.jar;C:\j2sdk1.4.2\jre\lib\charsets.jar;C:\j2sdk1.4.2\jre\classes, hibernate.dbcp.maxWait=120000, sun.java2d.fontpath=, java.vm.specification.vendor=Sun Microsystems Inc., java.runtime.version=1.4.2-b28, hibernate.cache.provider_class=net.sf.ehcache.hibernate.Provider, user.name=wrightdavi, hibernate.dbcp.ps.maxIdle=10, hibernate.dbcp.maxActive=100, hibernate.dbcp.maxIdle=10, user.language=en, sun.boot.library.path=C:\j2sdk1.4.2\jre\bin, java.version=1.4.2, user.timezone=America/New_York, sun.arch.data.model=32, java.endorsed.dirs=C:\j2sdk1.4.2\jre\lib\endorsed, sun.cpu.isalist=pentium i486 i386, file.encoding.pkg=sun.io, file.separator=\, java.specification.name=Java Platform API Specification, hibernate.cglib.use_reflection_optimizer=true, java.class.version=48.0, user.country=CA, java.home=C:\j2sdk1.4.2\jre, hibernate.dbcp.whenExhaustedAction=1, java.vm.info=mixed mode, hibernate.dbcp.ps.whenExhaustedAction=1, os.version=5.1, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory, path.separator=;, java.vm.version=1.4.2-b28, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, hibernate.connection.password=security1, user.variant=, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, hibernate.connection.username=security, user.home=C:\Documents and Settings\WrightDAVI, java.specification.vendor=Sun Microsystems Inc., hibernate.dbcp.ps.maxActive=100, java.library.path=C:\j2sdk1.4.2\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\oracle\ora8i\bin;C:\Program Files\Oracle\jre\1.1.7\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\oracle\Ora92\Olap\XSA632;C:\Program Files\Rational\common;C:\Program Files\Rational\ClearCase\bin;c:\j2sdk1.4.2\bin, java.vendor.url=http://java.sun.com/, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, java.class.path=C:\eclipse\workspace\TestHib\bin;C:\hibernate-2.1\hibernate2.jar;C:\hibernate-2.1\lib\odmg-3.0.jar;C:\hibernate-2.1\lib\cglib-full-2.0.1.jar;C:\hibernate-2.1\lib\commons-collections-2.1.jar;C:\hibernate-2.1\lib\commons-dbcp-1.1.jar;C:\hibernate-2.1\lib\commons-logging-1.0.3.jar;C:\hibernate-2.1\lib\commons-pool-1.1.jar;C:\hibernate-2.1\lib\dom4j-1.4.jar;C:\hibernate-2.1\lib\ehcache-0.7.jar;C:\hibernate-2.1\lib\jdbc2_0-stdext.jar;C:\jdev9052\jdbc\lib\nls_charset12.jar;C:\jdev9052\jdbc\lib\classes12.jar;C:\jdev9052\j2ee\home\lib\jta.jar;C:\jakarta-log4j-1.2.8\dist\lib\log4j-1.2.8.jar, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, hibernate.dbcp.testOnReturn=false, sun.cpu.endian=little, sun.os.patch.level=Service Pack 1, hibernate.connection.provider_class=net.sf.hibernate.connection.DBCPConnectionProvider, java.io.tmpdir=C:\DOCUME~1\WRIGHT~1\LOCALS~1\Temp\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, hibernate.dbcp.validationQuery=select 1 from
dual, os.arch=x86, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, hibernate.dbcp.testOnBorrow=true, java.ext.dirs=C:\j2sdk1.4.2\jre\lib\ext, user.dir=C:\eclipse\workspace\TestHib, line.separator=
, java.vm.name=Java HotSpot(TM) Client VM, file.encoding=Cp1252, java.specification.version=1.4, hibernate.show_sql=true, hibernate.connection.pool_size=30}
14:18:26,216 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
14:18:26,216 DEBUG SessionFactoryObjectFactory:76 - registered: 2c900038fda520a400fda520a6280000 (unnamed)
14:18:26,226 INFO SessionFactoryObjectFactory:82 - no JNDI name configured
14:18:26,226 DEBUG SessionFactoryImpl:196 - instantiated session factory
14:18:26,276 DEBUG SessionImpl:555 - opened session
14:18:26,276 DEBUG JDBCTransaction:37 - begin
14:18:26,306 DEBUG JDBCTransaction:41 - current autocommit status:false
Get Foo
14:18:26,306 DEBUG SessionImpl:1982 - loading [hibtest.Foo#10853]
14:18:26,306 DEBUG SessionImpl:2079 - attempting to resolve [hibtest.Foo#10853]
14:18:26,306 DEBUG SessionImpl:2112 - object not resolved in any cache [hibtest.Foo#10853]
14:18:26,316 DEBUG EntityPersister:416 - Materializing entity: [hibtest.Foo#10853]
14:18:26,316 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
14:18:26,316 DEBUG SQL:237 - select foo0_.incident_id as incident1_0_, foo0_.version as version0_, foo0_.incident_number as incident3_0_ from incident foo0_ where foo0_.incident_id=?
Hibernate: select foo0_.incident_id as incident1_0_, foo0_.version as version0_, foo0_.incident_number as incident3_0_ from incident foo0_ where foo0_.incident_id=?
14:18:26,316 DEBUG BatcherImpl:241 - preparing statement
14:18:26,326 DEBUG LongType:46 - binding '10853' to parameter: 1
14:18:26,366 DEBUG Loader:197 - processing result set
14:18:26,366 DEBUG Loader:405 - result row: 10853
14:18:26,366 DEBUG Loader:536 - Initializing object from ResultSet: 10853
14:18:26,366 DEBUG Loader:605 - Hydrating entity: hibtest.Foo#10853
14:18:26,376 DEBUG IntegerType:68 - returning '6' as column: version0_
14:18:26,376 DEBUG StringType:68 - returning '1999000898' as column: incident3_0_
14:18:26,376 DEBUG SessionImpl:1906 - Version: 6
14:18:26,376 DEBUG Loader:226 - done processing result set (1 rows)
14:18:26,376 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
14:18:26,376 DEBUG BatcherImpl:261 - closing statement
14:18:26,376 DEBUG Loader:239 - total objects hydrated: 1
14:18:26,386 DEBUG SessionImpl:2198 - resolving associations for [hibtest.Foo#10853]
14:18:26,386 DEBUG SessionImpl:3929 - creating collection wrapper:[hibtest.Foo.bars#10853]
14:18:26,386 DEBUG SessionImpl:2222 - done materializing entity [hibtest.Foo#10853]
14:18:26,386 DEBUG SessionImpl:3112 - initializing non-lazy collections
Initialize Bars
14:18:26,396 DEBUG SessionImpl:3256 - initializing collection [hibtest.Foo.bars#10853]
14:18:26,396 DEBUG SessionImpl:3257 - checking second-level cache
14:18:26,396 DEBUG SessionImpl:3263 - collection not cached
14:18:26,406 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
14:18:26,406 DEBUG SQL:237 - select bars0_.person_id as person_id__, bars0_.incident_id as incident3___, bars0_.person_id as person_id0_, bars0_.version as version0_ from persons_involved bars0_ where bars0_.incident_id=?
Hibernate: select bars0_.person_id as person_id__, bars0_.incident_id as incident3___, bars0_.person_id as person_id0_, bars0_.version as version0_ from persons_involved bars0_ where bars0_.incident_id=?
14:18:26,406 DEBUG BatcherImpl:241 - preparing statement
14:18:26,406 DEBUG LongType:46 - binding '10853' to parameter: 1
14:18:26,416 DEBUG Loader:327 - result set contains (possibly empty) collection: [hibtest.Foo.bars#10853]
14:18:26,416 DEBUG SessionImpl:3014 - uninitialized collection: initializing
14:18:26,416 DEBUG Loader:197 - processing result set
14:18:26,416 DEBUG LongType:68 - returning '10854' as column: person_id0_
14:18:26,416 DEBUG Loader:405 - result row: 10854
14:18:26,416 DEBUG Loader:536 - Initializing object from ResultSet: 10854
14:18:26,416 DEBUG Loader:605 - Hydrating entity: hibtest.Bar#10854
14:18:26,426 DEBUG IntegerType:68 - returning '8' as column: version0_
14:18:26,426 DEBUG SessionImpl:1906 - Version: 8
14:18:26,426 DEBUG LongType:68 - returning '10853' as column: incident3___
14:18:26,426 DEBUG Loader:292 - found row of collection: [hibtest.Foo.bars#10853]
14:18:26,426 DEBUG SessionImpl:3037 - reading row
14:18:26,426 DEBUG LongType:68 - returning '10854' as column: person_id__
14:18:26,426 DEBUG SessionImpl:1982 - loading [hibtest.Bar#10854]
14:18:26,426 DEBUG SessionImpl:2079 - attempting to resolve [hibtest.Bar#10854]
14:18:26,426 DEBUG SessionImpl:2095 - resolved object in session cache [hibtest.Bar#10854]
14:18:26,426 DEBUG Loader:226 - done processing result set (1 rows)
14:18:26,426 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
14:18:26,426 DEBUG BatcherImpl:261 - closing statement
14:18:26,426 DEBUG Loader:239 - total objects hydrated: 1
14:18:26,426 DEBUG SessionImpl:2198 - resolving associations for [hibtest.Bar#10854]
14:18:26,426 DEBUG SessionImpl:3929 - creating collection wrapper:[hibtest.Bar.subs#10854]
14:18:26,436 DEBUG SessionImpl:2222 - done materializing entity [hibtest.Bar#10854]
14:18:26,436 DEBUG SessionImpl:3073 - 1 collections were found in result set
14:18:26,436 DEBUG SessionImpl:3091 - collection fully initialized: [hibtest.Foo.bars#10853]
14:18:26,436 DEBUG SessionImpl:3094 - 1 collections initialized
14:18:26,436 DEBUG SessionImpl:3112 - initializing non-lazy collections
14:18:26,436 DEBUG SessionImpl:3265 - collection initialized
14:18:26,436 DEBUG JDBCTransaction:59 - commit
14:18:26,436 DEBUG SessionImpl:2242 - flushing session
14:18:26,436 DEBUG Cascades:497 - processing cascades for: hibtest.Foo
14:18:26,446 DEBUG Cascades:524 - cascading to collection: hibtest.Foo.bars
14:18:26,446 DEBUG Cascades:113 - cascading to saveOrUpdate()
14:18:26,446 DEBUG SessionImpl:1371 - saveOrUpdate() persistent instance
14:18:26,446 DEBUG Cascades:506 - done processing cascades for: hibtest.Foo
14:18:26,446 DEBUG Cascades:497 - processing cascades for: hibtest.Bar
14:18:26,446 DEBUG Cascades:524 - cascading to collection: hibtest.Bar.subs
14:18:26,446 DEBUG Cascades:506 - done processing cascades for: hibtest.Bar
14:18:26,446 DEBUG SessionImpl:2435 - Flushing entities and processing referenced collections
14:18:26,456 DEBUG SessionImpl:2880 - Collection found: [hibtest.Foo.bars#10853], was: [hibtest.Foo.bars#10853]
14:18:26,456 DEBUG SessionImpl:2880 - Collection found: [hibtest.Bar.subs#10854], was: [hibtest.Bar.subs#10854]
14:18:26,456 DEBUG SessionImpl:2776 - Processing unreferenced collections
14:18:26,456 DEBUG SessionImpl:2790 - Scheduling collection removes/(re)creates/updates
14:18:26,456 DEBUG SessionImpl:2266 - Flushed: 0 insertions, 0 updates, 0 deletions to 2 objects
14:18:26,456 DEBUG SessionImpl:2271 - Flushed: 0 (re)creations, 0 updates, 0 removals to 2 collections
14:18:26,456 DEBUG Printer:75 - listing entities:
14:18:26,456 DEBUG Printer:82 - hibtest.Bar{subs=uninitialized, id=10854, version=8}
14:18:26,466 DEBUG Printer:82 - hibtest.Foo{bars=[Bar#10854], fooNumber=1999000898, id=10853, version=6}
14:18:26,466 DEBUG SessionImpl:2355 - executing flush
14:18:26,466 DEBUG SessionImpl:2820 - post flush
14:18:26,466 DEBUG SessionImpl:585 - transaction completion
14:18:26,466 DEBUG SessionImpl:573 - closing session
14:18:26,466 DEBUG SessionImpl:3332 - disconnecting session
14:18:26,476 DEBUG SessionImpl:585 - transaction completion
Changing Foo
Session2
14:18:26,476 DEBUG SessionImpl:555 - opened session
14:18:26,476 DEBUG JDBCTransaction:37 - begin
14:18:26,496 DEBUG JDBCTransaction:41 - current autocommit status:false
Doing reattach
14:18:26,496 DEBUG Cascades:385 - version unsaved-value strategy NULL
14:18:26,496 DEBUG SessionImpl:1982 - loading [hibtest.Foo#10853]
14:18:26,496 DEBUG SessionImpl:2079 - attempting to resolve [hibtest.Foo#10853]
14:18:26,496 DEBUG SessionImpl:2112 - object not resolved in any cache [hibtest.Foo#10853]
14:18:26,496 DEBUG EntityPersister:416 - Materializing entity: [hibtest.Foo#10853]
14:18:26,496 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
14:18:26,506 DEBUG SQL:237 - select foo0_.incident_id as incident1_0_, foo0_.version as version0_, foo0_.incident_number as incident3_0_ from incident foo0_ where foo0_.incident_id=?
Hibernate: select foo0_.incident_id as incident1_0_, foo0_.version as version0_, foo0_.incident_number as incident3_0_ from incident foo0_ where foo0_.incident_id=?
14:18:26,506 DEBUG BatcherImpl:241 - preparing statement
14:18:26,506 DEBUG LongType:46 - binding '10853' to parameter: 1
14:18:26,506 DEBUG Loader:197 - processing result set
14:18:26,506 DEBUG Loader:405 - result row: 10853
14:18:26,506 DEBUG Loader:536 - Initializing object from ResultSet: 10853
14:18:26,506 DEBUG Loader:605 - Hydrating entity: hibtest.Foo#10853
14:18:26,506 DEBUG IntegerType:68 - returning '6' as column: version0_
14:18:26,506 DEBUG StringType:68 - returning '1999000898' as column: incident3_0_
14:18:26,506 DEBUG SessionImpl:1906 - Version: 6
14:18:26,516 DEBUG Loader:226 - done processing result set (1 rows)
14:18:26,516 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
14:18:26,516 DEBUG BatcherImpl:261 - closing statement
14:18:26,516 DEBUG Loader:239 - total objects hydrated: 1
14:18:26,516 DEBUG SessionImpl:2198 - resolving associations for [hibtest.Foo#10853]
14:18:26,516 DEBUG SessionImpl:3929 - creating collection wrapper:[hibtest.Foo.bars#10853]
14:18:26,516 DEBUG SessionImpl:2222 - done materializing entity [hibtest.Foo#10853]
14:18:26,516 DEBUG SessionImpl:3112 - initializing non-lazy collections
14:18:26,516 DEBUG Cascades:497 - processing cascades for: hibtest.Foo
14:18:26,516 DEBUG Cascades:524 - cascading to collection: hibtest.Foo.bars
14:18:26,516 DEBUG Cascades:131 - cascading to copy()
14:18:26,516 DEBUG Cascades:385 - version unsaved-value strategy NULL
14:18:26,516 DEBUG SessionImpl:1982 - loading [hibtest.Bar#10854]
14:18:26,516 DEBUG SessionImpl:2079 - attempting to resolve [hibtest.Bar#10854]
14:18:26,516 DEBUG SessionImpl:2112 - object not resolved in any cache [hibtest.Bar#10854]
14:18:26,516 DEBUG EntityPersister:416 - Materializing entity: [hibtest.Bar#10854]
14:18:26,516 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
14:18:26,516 DEBUG SQL:237 - select bar0_.person_id as person_id0_, bar0_.version as version0_ from persons_involved bar0_ where bar0_.person_id=?
Hibernate: select bar0_.person_id as person_id0_, bar0_.version as version0_ from persons_involved bar0_ where bar0_.person_id=?
14:18:26,516 DEBUG BatcherImpl:241 - preparing statement
14:18:26,516 DEBUG LongType:46 - binding '10854' to parameter: 1
14:18:26,526 DEBUG Loader:197 - processing result set
14:18:26,526 DEBUG Loader:405 - result row: 10854
14:18:26,536 DEBUG Loader:536 - Initializing object from ResultSet: 10854
14:18:26,536 DEBUG Loader:605 - Hydrating entity: hibtest.Bar#10854
14:18:26,536 DEBUG IntegerType:68 - returning '8' as column: version0_
14:18:26,536 DEBUG SessionImpl:1906 - Version: 8
14:18:26,536 DEBUG Loader:226 - done processing result set (1 rows)
14:18:26,536 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
14:18:26,536 DEBUG BatcherImpl:261 - closing statement
14:18:26,536 DEBUG Loader:239 - total objects hydrated: 1
14:18:26,536 DEBUG SessionImpl:2198 - resolving associations for [hibtest.Bar#10854]
14:18:26,536 DEBUG SessionImpl:3929 - creating collection wrapper:[hibtest.Bar.subs#10854]
14:18:26,536 DEBUG SessionImpl:2222 - done materializing entity [hibtest.Bar#10854]
14:18:26,536 DEBUG SessionImpl:3112 - initializing non-lazy collections
14:18:26,536 DEBUG Cascades:497 - processing cascades for: hibtest.Bar
14:18:26,536 DEBUG Cascades:524 - cascading to collection: hibtest.Bar.subs
14:18:26,536 DEBUG Cascades:506 - done processing cascades for: hibtest.Bar
14:18:26,546 DEBUG SessionImpl:3256 - initializing collection [hibtest.Bar.subs#10854]
14:18:26,546 DEBUG SessionImpl:3257 - checking second-level cache
14:18:26,546 DEBUG SessionImpl:3263 - collection not cached
14:18:26,546 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
14:18:26,546 DEBUG SQL:237 - select subs0_.incident_role_code as incident2___, subs0_.person_id as person_id__, sub1_.incident_role_code as incident1_0_, sub1_.desc_e as desc_e0_, sub1_.desc_f as desc_f0_ from incident_role subs0_ inner join incident_role_type sub1_ on subs0_.incident_role_code=sub1_.incident_role_code where subs0_.person_id=?
Hibernate: select subs0_.incident_role_code as incident2___, subs0_.person_id as person_id__, sub1_.incident_role_code as incident1_0_, sub1_.desc_e as desc_e0_, sub1_.desc_f as desc_f0_ from incident_role subs0_ inner join incident_role_type sub1_ on subs0_.incident_role_code=sub1_.incident_role_code where subs0_.person_id=?
14:18:26,546 DEBUG BatcherImpl:241 - preparing statement
14:18:26,546 DEBUG LongType:46 - binding '10854' to parameter: 1
14:18:26,556 DEBUG Loader:327 - result set contains (possibly empty) collection: [hibtest.Bar.subs#10854]
14:18:26,556 DEBUG SessionImpl:3014 - uninitialized collection: initializing
14:18:26,556 DEBUG Loader:197 - processing result set
14:18:26,556 DEBUG StringType:68 - returning '0004' as column: incident1_0_
14:18:26,556 DEBUG Loader:405 - result row: 0004
14:18:26,556 DEBUG Loader:536 - Initializing object from ResultSet: 0004
14:18:26,556 DEBUG Loader:605 - Hydrating entity: hibtest.Sub#0004
14:18:26,556 DEBUG StringType:68 - returning 'UNKNOWN ' as column: desc_e0_
14:18:26,566 DEBUG StringType:68 - returning 'INCONNU ' as column: desc_f0_
14:18:26,566 DEBUG LongType:68 - returning '10854' as column: person_id__
14:18:26,566 DEBUG Loader:292 - found row of collection: [hibtest.Bar.subs#10854]
14:18:26,566 DEBUG SessionImpl:3037 - reading row
14:18:26,566 DEBUG StringType:68 - returning '0004' as column: incident2___
14:18:26,566 DEBUG SessionImpl:1982 - loading [hibtest.Sub#0004]
14:18:26,566 DEBUG SessionImpl:2079 - attempting to resolve [hibtest.Sub#0004]
14:18:26,566 DEBUG SessionImpl:2095 - resolved object in session cache [hibtest.Sub#0004]
net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no session or session was closed
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:209)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Set.iterator(Set.java:130)
at net.sf.hibernate.type.PersistentCollectionType.copy(PersistentCollectionType.java:236)
at net.sf.hibernate.type.TypeFactory.copy(TypeFactory.java:284)
at net.sf.hibernate.impl.SessionImpl.doCopy(SessionImpl.java:4038)
at net.sf.hibernate.impl.SessionImpl.copy(SessionImpl.java:3980)
at net.sf.hibernate.engine.Cascades$5.cascade(Cascades.java:132)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
at net.sf.hibernate.impl.SessionImpl.doCopy(SessionImpl.java:4035)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdateCopy(SessionImpl.java:3976)
at hibtest.HibTest.main(HibTest.java:29)
14:18:26,566 DEBUG Loader:226 - done processing result set (1 rows)
14:18:26,566 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
14:18:26,566 DEBUG BatcherImpl:261 - closing statement
14:18:26,576 DEBUG Loader:239 - total objects hydrated: 1
14:18:26,576 DEBUG SessionImpl:2198 - resolving associations for [hibtest.Sub#0004]
14:18:26,576 DEBUG SessionImpl:2209 - adding entity to second-level cache [hibtest.Sub#0004]
14:18:26,576 DEBUG ReadOnlyCache:44 - Caching: 0004
14:18:26,576 DEBUG SessionImpl:2222 - done materializing entity [hibtest.Sub#0004]
14:18:26,576 DEBUG SessionImpl:3073 - 1 collections were found in result set
14:18:26,576 DEBUG SessionImpl:3091 - collection fully initialized: [hibtest.Bar.subs#10854]
14:18:26,576 DEBUG SessionImpl:3094 - 1 collections initialized
14:18:26,576 DEBUG SessionImpl:3112 - initializing non-lazy collections
14:18:26,576 DEBUG SessionImpl:3265 - collection initialized
14:18:26,586 ERROR LazyInitializationException:25 - Failed to lazily initialize a collection - no session or session was closed
net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no session or session was closed
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:209)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Set.iterator(Set.java:130)
at net.sf.hibernate.type.PersistentCollectionType.copy(PersistentCollectionType.java:236)
at net.sf.hibernate.type.TypeFactory.copy(TypeFactory.java:284)
at net.sf.hibernate.impl.SessionImpl.doCopy(SessionImpl.java:4038)
at net.sf.hibernate.impl.SessionImpl.copy(SessionImpl.java:3980)
at net.sf.hibernate.engine.Cascades$5.cascade(Cascades.java:132)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
at net.sf.hibernate.impl.SessionImpl.doCopy(SessionImpl.java:4035)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdateCopy(SessionImpl.java:3976)
at hibtest.HibTest.main(HibTest.java:29)
Exception in thread "main"
If the commented lines from the HibTest class are activated, the exception does not occur.