-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Bug: subclass contains collection of sibling subclass
PostPosted: Wed Apr 12, 2006 10:44 am 
Newbie

Joined: Fri Feb 06, 2004 1:37 pm
Posts: 9
If a map a subclass that contains a bag of sibling subclasses, I get a ClassCastException. Debugging this it appears that someow the CollectionEntry key is being initialized to the base class rather than the appropriate compisite key.

See mapping/code below. If there are no suggestions, I will submit this bug and test case to JIRA.

Thanks,
Mark

Hibernate version:
3.1.2

Mapping documents:
<hibernate-mapping>
<class name="org.hibernate.test.subclassbagofsibling.BaseDocument" table="VOUCHER" polymorphism="implicit">
<composite-id name="documentKey"
class="org.hibernate.test.subclassbagofsibling.DocumentKey">
<key-property name="key1" column="colKey1"/>
<key-property name="key2" column="colKey2"/>
<key-property name="documentType" column="DOCTYPE"/>
</composite-id>

<discriminator column="DOCTYPE" insert="false"/>
<property name="groupId" column="GROUPID"/>

<subclass name="org.hibernate.test.subclassbagofsibling.Authorization" discriminator-value="AUTH"/>

<subclass name="org.hibernate.test.subclassbagofsibling.Voucher" discriminator-value="VCH">
<bag name="authorizations" inverse="false" cascade="all, delete-orphan" where="DOCTYPE='AUTH'">
<key property-ref="groupId">
<column name="GROUPID"/>
</key>
<one-to-many class="org.hibernate.test.subclassbagofsibling.Authorization"/>
</bag>
</subclass>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Session s = openSession();
Transaction t = s.beginTransaction();

int groupId = 1;
int id = 1;
Authorization auth1 = new Authorization(new DocumentKey("A"+(id++), "A", "AUTH"), groupId);
Authorization auth2 = new Authorization(new DocumentKey("A"+(id++), "A", "AUTH"), groupId);
Authorization auth3 = new Authorization(new DocumentKey("A"+(id++), "A", "AUTH"), groupId);

DocumentKey vchKey = new DocumentKey("A", "A", "VCH");
Voucher v1 = new Voucher(vchKey, groupId);
v1.addAuthorization(auth1);
v1.addAuthorization(auth2);
v1.addAuthorization(auth3);
s.persist(v1);
t.commit();
s.close();

s = openSession();
t = s.beginTransaction();
v1 = (Voucher)s.load(Voucher.class, vchKey);
assertNotNull(v1);
List authorizations = v1.getAuthorizations();
assertNotNull(authorizations);
assertEquals(authorizations.size(), 3);

Full stack trace of any exception that occurs:
org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of org.hibernate.test.subclassbagofsibling.DocumentKey.key1
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171)
at org.hibernate.tuple.AbstractComponentTuplizer.getPropertyValue(AbstractComponentTuplizer.java:121)
at org.hibernate.tuple.AbstractComponentTuplizer.getPropertyValues(AbstractComponentTuplizer.java:133)
at org.hibernate.tuple.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:88)
at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:307)
at org.hibernate.type.ComponentType.getHashCode(ComponentType.java:158)
at org.hibernate.engine.EntityKey.getHashCode(EntityKey.java:69)
at org.hibernate.engine.EntityKey.<init>(EntityKey.java:42)
at org.hibernate.engine.StatefulPersistenceContext.getCollectionOwner(StatefulPersistenceContext.java:727)
at org.hibernate.loader.Loader.readCollectionElement(Loader.java:980)
at org.hibernate.loader.Loader.readCollectionElements(Loader.java:635)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:71)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1627)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:383)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:102)
at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:127)
at org.hibernate.collection.PersistentBag.size(PersistentBag.java:222)
at org.hibernate.test.subclassbagofsibling.HibTest.testFoo(HibTest.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at org.hibernate.test.TestCase.runTest(TestCase.java:140)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@6d0040
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:145)
... 39 more

Name and version of the database you are using:
Oracle 10g, also tested with MySQL and HSQL

The generated SQL (show_sql=true):
Hibernate: insert into VOUCHER (GROUPID, colKey1, colKey2, DOCTYPE) values (?, ?, ?, ?)
Hibernate: insert into VOUCHER (GROUPID, colKey1, colKey2, DOCTYPE) values (?, ?, ?, ?)
Hibernate: insert into VOUCHER (GROUPID, colKey1, colKey2, DOCTYPE) values (?, ?, ?, ?)
Hibernate: insert into VOUCHER (GROUPID, colKey1, colKey2, DOCTYPE) values (?, ?, ?, ?)
Hibernate: update VOUCHER set GROUPID=? where colKey1=? and colKey2=? and DOCTYPE=?
Hibernate: update VOUCHER set GROUPID=? where colKey1=? and colKey2=? and DOCTYPE=?
Hibernate: update VOUCHER set GROUPID=? where colKey1=? and colKey2=? and DOCTYPE=?
Hibernate: select voucher0_.colKey1 as colKey1_0_0_, voucher0_.colKey2 as colKey2_0_0_, voucher0_.DOCTYPE as DOCTYPE0_0_, voucher0_.GROUPID as GROUPID0_0_ from VOUCHER voucher0_ where voucher0_.colKey1=? and voucher0_.colKey2=? and voucher0_.DOCTYPE=? and voucher0_.DOCTYPE='VCH'
Hibernate: select authorizat0_.GROUPID as GROUPID1_, authorizat0_.colKey1 as colKey1_1_, authorizat0_.colKey2 as colKey2_1_, authorizat0_.DOCTYPE as DOCTYPE1_, authorizat0_.colKey1 as colKey1_0_0_, authorizat0_.colKey2 as colKey2_0_0_, authorizat0_.DOCTYPE as DOCTYPE0_0_, authorizat0_.GROUPID as GROUPID0_0_ from VOUCHER authorizat0_ where authorizat0_.DOCTYPE='AUTH' and authorizat0_.GROUPID=?

Debug level Hibernate log excerpt:
Hibernate 3.1
loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.max_fetch_depth=1, hibernate.dialect=org.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.format_sql=false, hibernate.query.substitutions=yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=test, hibernate.cache.region_prefix=hibernate.test, hibernate.hbm2ddl.auto=update, hibernate.connection.url=jdbc:mysql:///test, hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=1}
using java.io streams to persist binary types
using CGLIB reflection optimizer
using JDK 1.4 java.sql.Timestamp handling
Reading mappings from resource: org/hibernate/test/subclassbagofsibling/BaseDocument.hbm.xml
trying to locate http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/
found http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath
Mapping class: org.hibernate.test.subclassbagofsibling.BaseDocument -> VOUCHER
Mapped property: key1 -> colKey1
Mapped property: key2 -> colKey2
Mapped property: documentType -> DOCTYPE
Mapped property: documentKey -> colKey1, colKey2, DOCTYPE
Mapped property: groupId -> GROUPID
Mapping subclass: org.hibernate.test.subclassbagofsibling.Authorization -> VOUCHER
Mapping subclass: org.hibernate.test.subclassbagofsibling.Voucher -> VOUCHER
Mapped property: authorizations
Using dialect: org.hibernate.dialect.MySQLDialect
Preparing to build session factory with filters : {}
processing extends queue
processing collection mappings
Second pass for collection: org.hibernate.test.subclassbagofsibling.Voucher.authorizations
Mapping collection: org.hibernate.test.subclassbagofsibling.Voucher.authorizations -> VOUCHER
Mapped collection key: GROUPID, one-to-many: org.hibernate.test.subclassbagofsibling.Authorization
processing association property references
processing foreign key constraints
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
Using Hibernate built-in connection pool (not for production use!)
Hibernate connection pool size: 1
autocommit mode: false
using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql:///test
connection properties: {user=test, password=test}
total checked-out connections: 0
opening new JDBC connection
created connection to: jdbc:mysql:///test, Isolation Level: 4
RDBMS: MySQL, version: 4.1.12a-nt
JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.0.10-stable ( $Date: 2004/01/13 21:56:18 $, $Revision: 1.27.2.33 $ )
returning connection to pool, pool size: 1
Using dialect: org.hibernate.dialect.MySQLDialect
Using default transaction strategy (direct JDBC transactions)
No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Automatic flush during beforeCompletion(): disabled
Automatic session close at end of transaction: disabled
JDBC batch size: 15
JDBC batch updates for versioned data: enabled
Scrollable result sets: enabled
Wrap result sets: disabled
JDBC3 getGeneratedKeys(): enabled
Connection release mode: auto
Maximum outer join fetch depth: 1
Default batch fetch size: 1
Generate SQL with comments: disabled
Order SQL updates by primary key: disabled
Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Using ASTQueryTranslatorFactory
Query language substitutions: {no='N', yes='Y'}
Second-level cache: enabled
Query cache: disabled
Cache provider: org.hibernate.cache.HashtableCacheProvider
Optimize cache for minimal puts: disabled
Cache region prefix: hibernate.test
Structured second-level cache entries: disabled
Using dialect defined converter
Statistics: disabled
Deleted entity synthetic identifier rollback: disabled
Default entity-mode: pojo
building session factory
Session factory constructed with filter configurations : {}
instantiating session factory with properties: {java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.connection.password=test, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, sun.boot.library.path=C:\Program Files\Java\jdk1.5.0_05\jre\bin, java.vm.version=1.5.0_05-b05, hibernate.proxool.pool_alias=pool1, hibernate.connection.username=test, 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 1, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\javaMisc\hibernate-3.1, java.runtime.version=1.5.0_05-b05, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Program Files\Java\jdk1.5.0_05\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\s393643\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, hibernate.jdbc.batch_versioned_data=true, hibernate.cache.region_prefix=hibernate.test, sun.jnu.encoding=Cp1252, java.library.path=C:\Program Files\Java\jdk1.5.0_05\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\PROGRA~1\GRADKE~1\DBSIGN~1\lib;C:\oracle\product\10.2.0\client_1\bin;C:\oracle\product\10.2.0\client_1;C:\Program Files\Java\jdk1.5.0_03\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;c:\bin;C:\Program Files\MySQL\MySQL Server 4.1\bin;C:\Program Files\Subversion\bin;C:\Program Files\FastSum;C:\Program Files\QuickTime\QTSystem\;C:\Sun\jwsdp-1.6\jwsdp-shared\bin;c:\javaMisc\maven-2.0.2\bin;c:\javaMisc\apache-ant-1.6.5\bin;C:\Program Files\Apache Software Foundation\Maven 1.0.2\bin;C:\javaMisc\wsi-test-tools\java\bin, java.specification.name=Java Platform API Specification, java.class.version=49.0, hibernate.connection.pool_size=1, sun.management.compiler=HotSpot Client Compiler, os.version=5.1, user.home=C:\Documents and Settings\s393643, user.timezone=America/New_York, java.awt.printerjob=sun.awt.windows.WPrinterJob, java.specification.version=1.5, file.encoding=Cp1252, hibernate.format_sql=false, hibernate.connection.driver_class=com.mysql.jdbc.Driver, user.name=s393643, java.class.path=C:\javaMisc\hibernate-3.1\bin;C:\javaMisc\hibernate-3.1\hibernate3.jar;C:\javaMisc\hibernate-3.1\lib\ant-1.6.5.jar;C:\javaMisc\hibernate-3.1\lib\ant-antlr-1.6.5.jar;C:\javaMisc\hibernate-3.1\lib\ant-junit-1.6.5.jar;C:\javaMisc\hibernate-3.1\lib\ant-launcher-1.6.5.jar;C:\javaMisc\hibernate-3.1\lib\antlr-2.7.6rc1.jar;C:\javaMisc\hibernate-3.1\lib\ant-swing-1.6.5.jar;C:\javaMisc\hibernate-3.1\lib\asm.jar;C:\javaMisc\hibernate-3.1\lib\asm-attrs.jar;C:\javaMisc\hibernate-3.1\lib\c3p0-0.9.0.jar;C:\javaMisc\hibernate-3.1\lib\cglib-2.1.3.jar;C:\javaMisc\hibernate-3.1\lib\cleanimports.jar;C:\javaMisc\hibernate-3.1\lib\commons-collections-2.1.1.jar;C:\javaMisc\hibernate-3.1\lib\commons-logging-1.0.4.jar;C:\javaMisc\hibernate-3.1\lib\concurrent-1.3.2.jar;C:\javaMisc\hibernate-3.1\lib\connector.jar;C:\javaMisc\hibernate-3.1\lib\dom4j-1.6.1.jar;C:\javaMisc\hibernate-3.1\lib\ehcache-1.1.jar;C:\javaMisc\hibernate-3.1\lib\jaas.jar;C:\javaMisc\hibernate-3.1\lib\jacc-1_0-fr.jar;C:\javaMisc\hibernate-3.1\lib\jaxen-1.1-beta-7.jar;C:\javaMisc\hibernate-3.1\lib\jboss-cache.jar;C:\javaMisc\hibernate-3.1\lib\jboss-common.jar;C:\javaMisc\hibernate-3.1\lib\jboss-jmx.jar;C:\javaMisc\hibernate-3.1\lib\jboss-system.jar;C:\javaMisc\hibernate-3.1\lib\jdbc2_0-stdext.jar;C:\javaMisc\hibernate-3.1\lib\jgroups-2.2.7.jar;C:\javaMisc\hibernate-3.1\lib\jta.jar;C:\javaMisc\hibernate-3.1\lib\junit-3.8.1.jar;C:\javaMisc\hibernate-3.1\lib\log4j-1.2.11.jar;C:\javaMisc\hibernate-3.1\lib\oscache-2.1.jar;C:\javaMisc\hibernate-3.1\lib\proxool-0.8.3.jar;C:\javaMisc\hibernate-3.1\lib\swarmcache-1.0rc2.jar;C:\javaMisc\hibernate-3.1\lib\syndiag2.jar;C:\javaMisc\hibernate-3.1\lib\versioncheck.jar;C:\javaMisc\hibernate-3.1\lib\xerces-2.6.2.jar;C:\javaMisc\hibernate-3.1\lib\xml-apis.jar;C:\javaMisc\hibernate-3.1\lib\hsqldb.jar;C:\javaMisc\hibernate-3.1\lib\mysql-connector-java-3.0.10.jar;/c:/eclipse/plugins/org.eclipse.jdt.junit_3.1.1/junitsupport.jar;/c:/eclipse/plugins/org.eclipse.jdt.junit.runtime_3.1.0/junitruntime.jar, hibernate.query.substitutions=yes 'Y', no 'N', java.vm.specification.version=1.0, sun.arch.data.model=32, java.home=C:\Program Files\Java\jdk1.5.0_05\jre, hibernate.connection.url=jdbc:mysql:///test, hibernate.dialect=org.hibernate.dialect.MySQLDialect, java.specification.vendor=Sun Microsystems Inc., user.language=en, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, hibernate.cglib.use_reflection_optimizer=true, java.version=1.5.0_05, hibernate.jdbc.use_streams_for_binary=true, java.ext.dirs=C:\Program Files\Java\jdk1.5.0_05\jre\lib\ext, sun.boot.class.path=C:\Program Files\Java\jdk1.5.0_05\jre\lib\rt.jar;C:\Program Files\Java\jdk1.5.0_05\jre\lib\i18n.jar;C:\Program Files\Java\jdk1.5.0_05\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.5.0_05\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.5.0_05\jre\lib\jce.jar;C:\Program Files\Java\jdk1.5.0_05\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.5.0_05\jre\classes, java.vendor=Sun Microsystems Inc., file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, hibernate.hbm2ddl.auto=create-drop, sun.cpu.endian=little, sun.io.unicode.encoding=UnicodeLittle, sun.desktop=windows, hibernate.max_fetch_depth=1, sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86}
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
instantiating cache region: hibernate.test.org.hibernate.test.subclassbagofsibling.BaseDocument usage strategy: nonstrict-read-write
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.BaseDocument, IllegalArgumentException: Cannot find matching method/constructor
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
Static SQL for entity: org.hibernate.test.subclassbagofsibling.BaseDocument
Version select: select colKey1, colKey2, DOCTYPE from VOUCHER where colKey1 =? and colKey2 =? and DOCTYPE =?
Snapshot select: select basedocume_.colKey1, basedocume_.colKey2, basedocume_.DOCTYPE, basedocume_.GROUPID as GROUPID0_ from VOUCHER basedocume_ where basedocume_.colKey1=? and basedocume_.colKey2=? and basedocume_.DOCTYPE=?
Insert 0: insert into VOUCHER (GROUPID, colKey1, colKey2, DOCTYPE) values (?, ?, ?, ?)
Update 0: update VOUCHER set GROUPID=? where colKey1=? and colKey2=? and DOCTYPE=?
Delete 0: delete from VOUCHER where colKey1=? and colKey2=? and DOCTYPE=?
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.Voucher, IllegalArgumentException: Cannot find matching method/constructor
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
Static SQL for entity: org.hibernate.test.subclassbagofsibling.Voucher
Version select: select colKey1, colKey2, DOCTYPE from VOUCHER where colKey1 =? and colKey2 =? and DOCTYPE =?
Snapshot select: select voucher_.colKey1, voucher_.colKey2, voucher_.DOCTYPE, voucher_.GROUPID as GROUPID0_ from VOUCHER voucher_ where voucher_.colKey1=? and voucher_.colKey2=? and voucher_.DOCTYPE=?
Insert 0: insert into VOUCHER (GROUPID, colKey1, colKey2, DOCTYPE) values (?, ?, ?, ?)
Update 0: update VOUCHER set GROUPID=? where colKey1=? and colKey2=? and DOCTYPE=?
Delete 0: delete from VOUCHER where colKey1=? and colKey2=? and DOCTYPE=?
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.Authorization, IllegalArgumentException: Cannot find matching method/constructor
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
Static SQL for entity: org.hibernate.test.subclassbagofsibling.Authorization
Version select: select colKey1, colKey2, DOCTYPE from VOUCHER where colKey1 =? and colKey2 =? and DOCTYPE =?
Snapshot select: select authorizat_.colKey1, authorizat_.colKey2, authorizat_.DOCTYPE, authorizat_.GROUPID as GROUPID0_ from VOUCHER authorizat_ where authorizat_.colKey1=? and authorizat_.colKey2=? and authorizat_.DOCTYPE=?
Insert 0: insert into VOUCHER (GROUPID, colKey1, colKey2, DOCTYPE) values (?, ?, ?, ?)
Update 0: update VOUCHER set GROUPID=? where colKey1=? and colKey2=? and DOCTYPE=?
Delete 0: delete from VOUCHER where colKey1=? and colKey2=? and DOCTYPE=?
instantiating cache region: hibernate.test.org.hibernate.test.subclassbagofsibling.Voucher.authorizations usage strategy: nonstrict-read-write
Static SQL for collection: org.hibernate.test.subclassbagofsibling.Voucher.authorizations
Row insert: update VOUCHER set GROUPID=? where colKey1=? and colKey2=? and DOCTYPE=?
Row delete: update VOUCHER set GROUPID=null where GROUPID=? and colKey1=? and colKey2=? and DOCTYPE=?
One-shot delete: update VOUCHER set GROUPID=null where GROUPID=? and DOCTYPE='AUTH'
Static select for entity org.hibernate.test.subclassbagofsibling.BaseDocument: select basedocume0_.colKey1 as colKey1_0_0_, basedocume0_.colKey2 as colKey2_0_0_, basedocume0_.DOCTYPE as DOCTYPE0_0_, basedocume0_.GROUPID as GROUPID0_0_ from VOUCHER basedocume0_ where basedocume0_.colKey1=? and basedocume0_.colKey2=? and basedocume0_.DOCTYPE=?
Static select for entity org.hibernate.test.subclassbagofsibling.BaseDocument: select basedocume0_.colKey1 as colKey1_0_0_, basedocume0_.colKey2 as colKey2_0_0_, basedocume0_.DOCTYPE as DOCTYPE0_0_, basedocume0_.GROUPID as GROUPID0_0_ from VOUCHER basedocume0_ where basedocume0_.colKey1=? and basedocume0_.colKey2=? and basedocume0_.DOCTYPE=?
Static select for entity org.hibernate.test.subclassbagofsibling.BaseDocument: select basedocume0_.colKey1 as colKey1_0_0_, basedocume0_.colKey2 as colKey2_0_0_, basedocume0_.DOCTYPE as DOCTYPE0_0_, basedocume0_.GROUPID as GROUPID0_0_ from VOUCHER basedocume0_ where basedocume0_.colKey1=? and basedocume0_.colKey2=? and basedocume0_.DOCTYPE=? for update
Static select for entity org.hibernate.test.subclassbagofsibling.BaseDocument: select basedocume0_.colKey1 as colKey1_0_0_, basedocume0_.colKey2 as colKey2_0_0_, basedocume0_.DOCTYPE as DOCTYPE0_0_, basedocume0_.GROUPID as GROUPID0_0_ from VOUCHER basedocume0_ where basedocume0_.colKey1=? and basedocume0_.colKey2=? and basedocume0_.DOCTYPE=? for update
Static select for action ACTION_MERGE on entity org.hibernate.test.subclassbagofsibling.BaseDocument: select basedocume0_.colKey1 as colKey1_0_1_, basedocume0_.colKey2 as colKey2_0_1_, basedocume0_.DOCTYPE as DOCTYPE0_1_, basedocume0_.GROUPID as GROUPID0_1_, authorizat1_.GROUPID as GROUPID3_, authorizat1_.colKey1 as colKey1_3_, authorizat1_.colKey2 as colKey2_3_, authorizat1_.DOCTYPE as DOCTYPE3_, authorizat1_.colKey1 as colKey1_0_0_, authorizat1_.colKey2 as colKey2_0_0_, authorizat1_.DOCTYPE as DOCTYPE0_0_, authorizat1_.GROUPID as GROUPID0_0_ from VOUCHER basedocume0_ left outer join VOUCHER authorizat1_ on basedocume0_.GROUPID=authorizat1_.GROUPID and authorizat1_.DOCTYPE='AUTH' where basedocume0_.colKey1=? and basedocume0_.colKey2=? and basedocume0_.DOCTYPE=?
Static select for action ACTION_REFRESH on entity org.hibernate.test.subclassbagofsibling.BaseDocument: select basedocume0_.colKey1 as colKey1_0_1_, basedocume0_.colKey2 as colKey2_0_1_, basedocume0_.DOCTYPE as DOCTYPE0_1_, basedocume0_.GROUPID as GROUPID0_1_, authorizat1_.GROUPID as GROUPID3_, authorizat1_.colKey1 as colKey1_3_, authorizat1_.colKey2 as colKey2_3_, authorizat1_.DOCTYPE as DOCTYPE3_, authorizat1_.colKey1 as colKey1_0_0_, authorizat1_.colKey2 as colKey2_0_0_, authorizat1_.DOCTYPE as DOCTYPE0_0_, authorizat1_.GROUPID as GROUPID0_0_ from VOUCHER basedocume0_ left outer join VOUCHER authorizat1_ on basedocume0_.GROUPID=authorizat1_.GROUPID and authorizat1_.DOCTYPE='AUTH' where basedocume0_.colKey1=? and basedocume0_.colKey2=? and basedocume0_.DOCTYPE=?
Static select for entity org.hibernate.test.subclassbagofsibling.Voucher: select voucher0_.colKey1 as colKey1_0_0_, voucher0_.colKey2 as colKey2_0_0_, voucher0_.DOCTYPE as DOCTYPE0_0_, voucher0_.GROUPID as GROUPID0_0_ from VOUCHER voucher0_ where voucher0_.colKey1=? and voucher0_.colKey2=? and voucher0_.DOCTYPE=? and voucher0_.DOCTYPE='VCH'
Static select for entity org.hibernate.test.subclassbagofsibling.Voucher: select voucher0_.colKey1 as colKey1_0_0_, voucher0_.colKey2 as colKey2_0_0_, voucher0_.DOCTYPE as DOCTYPE0_0_, voucher0_.GROUPID as GROUPID0_0_ from VOUCHER voucher0_ where voucher0_.colKey1=? and voucher0_.colKey2=? and voucher0_.DOCTYPE=? and voucher0_.DOCTYPE='VCH'
Static select for entity org.hibernate.test.subclassbagofsibling.Voucher: select voucher0_.colKey1 as colKey1_0_0_, voucher0_.colKey2 as colKey2_0_0_, voucher0_.DOCTYPE as DOCTYPE0_0_, voucher0_.GROUPID as GROUPID0_0_ from VOUCHER voucher0_ where voucher0_.colKey1=? and voucher0_.colKey2=? and voucher0_.DOCTYPE=? and voucher0_.DOCTYPE='VCH' for update
Static select for entity org.hibernate.test.subclassbagofsibling.Voucher: select voucher0_.colKey1 as colKey1_0_0_, voucher0_.colKey2 as colKey2_0_0_, voucher0_.DOCTYPE as DOCTYPE0_0_, voucher0_.GROUPID as GROUPID0_0_ from VOUCHER voucher0_ where voucher0_.colKey1=? and voucher0_.colKey2=? and voucher0_.DOCTYPE=? and voucher0_.DOCTYPE='VCH' for update
Static select for action ACTION_MERGE on entity org.hibernate.test.subclassbagofsibling.Voucher: select voucher0_.colKey1 as colKey1_0_1_, voucher0_.colKey2 as colKey2_0_1_, voucher0_.DOCTYPE as DOCTYPE0_1_, voucher0_.GROUPID as GROUPID0_1_, authorizat1_.GROUPID as GROUPID3_, authorizat1_.colKey1 as colKey1_3_, authorizat1_.colKey2 as colKey2_3_, authorizat1_.DOCTYPE as DOCTYPE3_, authorizat1_.colKey1 as colKey1_0_0_, authorizat1_.colKey2 as colKey2_0_0_, authorizat1_.DOCTYPE as DOCTYPE0_0_, authorizat1_.GROUPID as GROUPID0_0_ from VOUCHER voucher0_ left outer join VOUCHER authorizat1_ on voucher0_.GROUPID=authorizat1_.GROUPID and authorizat1_.DOCTYPE='AUTH' where voucher0_.colKey1=? and voucher0_.colKey2=? and voucher0_.DOCTYPE=? and voucher0_.DOCTYPE='VCH'
Static select for action ACTION_REFRESH on entity org.hibernate.test.subclassbagofsibling.Voucher: select voucher0_.colKey1 as colKey1_0_1_, voucher0_.colKey2 as colKey2_0_1_, voucher0_.DOCTYPE as DOCTYPE0_1_, voucher0_.GROUPID as GROUPID0_1_, authorizat1_.GROUPID as GROUPID3_, authorizat1_.colKey1 as colKey1_3_, authorizat1_.colKey2 as colKey2_3_, authorizat1_.DOCTYPE as DOCTYPE3_, authorizat1_.colKey1 as colKey1_0_0_, authorizat1_.colKey2 as colKey2_0_0_, authorizat1_.DOCTYPE as DOCTYPE0_0_, authorizat1_.GROUPID as GROUPID0_0_ from VOUCHER voucher0_ left outer join VOUCHER authorizat1_ on voucher0_.GROUPID=authorizat1_.GROUPID and authorizat1_.DOCTYPE='AUTH' where voucher0_.colKey1=? and voucher0_.colKey2=? and voucher0_.DOCTYPE=? and voucher0_.DOCTYPE='VCH'
Static select for entity org.hibernate.test.subclassbagofsibling.Authorization: select authorizat0_.colKey1 as colKey1_0_0_, authorizat0_.colKey2 as colKey2_0_0_, authorizat0_.DOCTYPE as DOCTYPE0_0_, authorizat0_.GROUPID as GROUPID0_0_ from VOUCHER authorizat0_ where authorizat0_.colKey1=? and authorizat0_.colKey2=? and authorizat0_.DOCTYPE=? and authorizat0_.DOCTYPE='AUTH'
Static select for entity org.hibernate.test.subclassbagofsibling.Authorization: select authorizat0_.colKey1 as colKey1_0_0_, authorizat0_.colKey2 as colKey2_0_0_, authorizat0_.DOCTYPE as DOCTYPE0_0_, authorizat0_.GROUPID as GROUPID0_0_ from VOUCHER authorizat0_ where authorizat0_.colKey1=? and authorizat0_.colKey2=? and authorizat0_.DOCTYPE=? and authorizat0_.DOCTYPE='AUTH'
Static select for entity org.hibernate.test.subclassbagofsibling.Authorization: select authorizat0_.colKey1 as colKey1_0_0_, authorizat0_.colKey2 as colKey2_0_0_, authorizat0_.DOCTYPE as DOCTYPE0_0_, authorizat0_.GROUPID as GROUPID0_0_ from VOUCHER authorizat0_ where authorizat0_.colKey1=? and authorizat0_.colKey2=? and authorizat0_.DOCTYPE=? and authorizat0_.DOCTYPE='AUTH' for update
Static select for entity org.hibernate.test.subclassbagofsibling.Authorization: select authorizat0_.colKey1 as colKey1_0_0_, authorizat0_.colKey2 as colKey2_0_0_, authorizat0_.DOCTYPE as DOCTYPE0_0_, authorizat0_.GROUPID as GROUPID0_0_ from VOUCHER authorizat0_ where authorizat0_.colKey1=? and authorizat0_.colKey2=? and authorizat0_.DOCTYPE=? and authorizat0_.DOCTYPE='AUTH' for update
Static select for action ACTION_MERGE on entity org.hibernate.test.subclassbagofsibling.Authorization: select authorizat0_.colKey1 as colKey1_0_0_, authorizat0_.colKey2 as colKey2_0_0_, authorizat0_.DOCTYPE as DOCTYPE0_0_, authorizat0_.GROUPID as GROUPID0_0_ from VOUCHER authorizat0_ where authorizat0_.colKey1=? and authorizat0_.colKey2=? and authorizat0_.DOCTYPE=? and authorizat0_.DOCTYPE='AUTH'
Static select for action ACTION_REFRESH on entity org.hibernate.test.subclassbagofsibling.Authorization: select authorizat0_.colKey1 as colKey1_0_0_, authorizat0_.colKey2 as colKey2_0_0_, authorizat0_.DOCTYPE as DOCTYPE0_0_, authorizat0_.GROUPID as GROUPID0_0_ from VOUCHER authorizat0_ where authorizat0_.colKey1=? and authorizat0_.colKey2=? and authorizat0_.DOCTYPE=? and authorizat0_.DOCTYPE='AUTH'
Static select for one-to-many org.hibernate.test.subclassbagofsibling.Voucher.authorizations: select authorizat0_.GROUPID as GROUPID1_, authorizat0_.colKey1 as colKey1_1_, authorizat0_.colKey2 as colKey2_1_, authorizat0_.DOCTYPE as DOCTYPE1_, authorizat0_.colKey1 as colKey1_0_0_, authorizat0_.colKey2 as colKey2_0_0_, authorizat0_.DOCTYPE as DOCTYPE0_0_, authorizat0_.GROUPID as GROUPID0_0_ from VOUCHER authorizat0_ where authorizat0_.DOCTYPE='AUTH' and authorizat0_.GROUPID=?
initializing class SessionFactoryObjectFactory
registered: 1ef21ec10a8e89ae010a8e89b2800000 (unnamed)
Not binding factory to JNDI, no JNDI name configured
instantiated session factory
processing extends queue
processing collection mappings
processing association property references
processing foreign key constraints
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
processing extends queue
processing collection mappings
processing association property references
processing foreign key constraints
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
Running hbm2ddl schema export
import file not found: /import.sql
exporting generated schema to database
total checked-out connections: 0
using pooled JDBC connection, pool size: 0
drop table if exists VOUCHER
create table VOUCHER (colKey1 varchar(255) not null, colKey2 varchar(255) not null, DOCTYPE varchar(255) not null, GROUPID integer, primary key (colKey1, colKey2, DOCTYPE))
schema export complete
returning connection to pool, pool size: 1
processing extends queue
processing collection mappings
processing association property references
processing foreign key constraints
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
processing extends queue
processing collection mappings
processing association property references
processing foreign key constraints
reflection optimizer disabled for: org.hibernate.test.subclassbagofsibling.DocumentKey, IllegalArgumentException: Cannot find matching method/constructor
Checking 0 named HQL queries
Checking 0 named SQL queries
opened session 24248500 at timestamp: 4689316616749056
begin
opening JDBC connection
total checked-out connections: 0
using pooled JDBC connection, pool size: 0
current autocommit status: false
after transaction begin
id unsaved-value strategy UNDEFINED
Cache lookup: org.hibernate.test.subclassbagofsibling.BaseDocument#org.hibernate.test.subclassbagofsibling.DocumentKey@14bbd
Cache miss
transient instance of: org.hibernate.test.subclassbagofsibling.Voucher
saving transient instance
generated identifier: component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}, using strategy: org.hibernate.id.Assigned
saving [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
processing cascade ACTION_PERSIST for: org.hibernate.test.subclassbagofsibling.Voucher
done processing cascade ACTION_PERSIST for: org.hibernate.test.subclassbagofsibling.Voucher
Wrapped collection in role: org.hibernate.test.subclassbagofsibling.Voucher.authorizations
processing cascade ACTION_PERSIST for: org.hibernate.test.subclassbagofsibling.Voucher
cascade ACTION_PERSIST for collection: org.hibernate.test.subclassbagofsibling.Voucher.authorizations
cascading to persist: org.hibernate.test.subclassbagofsibling.Authorization
id unsaved-value strategy UNDEFINED
Cache lookup: org.hibernate.test.subclassbagofsibling.BaseDocument#org.hibernate.test.subclassbagofsibling.DocumentKey@1eddf9
Cache miss
transient instance of: org.hibernate.test.subclassbagofsibling.Authorization
saving transient instance
generated identifier: component[key1,key2,documentType]{key1=A1, documentType=AUTH, key2=A}, using strategy: org.hibernate.id.Assigned
saving [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A1, documentType=AUTH, key2=A}]
cascading to persist: org.hibernate.test.subclassbagofsibling.Authorization
id unsaved-value strategy UNDEFINED
Cache lookup: org.hibernate.test.subclassbagofsibling.BaseDocument#org.hibernate.test.subclassbagofsibling.DocumentKey@1eddfa
Cache miss
transient instance of: org.hibernate.test.subclassbagofsibling.Authorization
saving transient instance
generated identifier: component[key1,key2,documentType]{key1=A2, documentType=AUTH, key2=A}, using strategy: org.hibernate.id.Assigned
saving [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A2, documentType=AUTH, key2=A}]
cascading to persist: org.hibernate.test.subclassbagofsibling.Authorization
id unsaved-value strategy UNDEFINED
Cache lookup: org.hibernate.test.subclassbagofsibling.BaseDocument#org.hibernate.test.subclassbagofsibling.DocumentKey@1eddfb
Cache miss
transient instance of: org.hibernate.test.subclassbagofsibling.Authorization
saving transient instance
generated identifier: component[key1,key2,documentType]{key1=A3, documentType=AUTH, key2=A}, using strategy: org.hibernate.id.Assigned
saving [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A3, documentType=AUTH, key2=A}]
done cascade ACTION_PERSIST for collection: org.hibernate.test.subclassbagofsibling.Voucher.authorizations
done processing cascade ACTION_PERSIST for: org.hibernate.test.subclassbagofsibling.Voucher
commit
automatically flushing session
flushing session
processing flush-time cascades
processing cascade ACTION_SAVE_UPDATE for: org.hibernate.test.subclassbagofsibling.Voucher
cascade ACTION_SAVE_UPDATE for collection: org.hibernate.test.subclassbagofsibling.Voucher.authorizations
cascading to saveOrUpdate: org.hibernate.test.subclassbagofsibling.Authorization
persistent instance of: org.hibernate.test.subclassbagofsibling.Authorization
ignoring persistent instance
object already associated with session: [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A1, documentType=AUTH, key2=A}]
cascading to saveOrUpdate: org.hibernate.test.subclassbagofsibling.Authorization
persistent instance of: org.hibernate.test.subclassbagofsibling.Authorization
ignoring persistent instance
object already associated with session: [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A2, documentType=AUTH, key2=A}]
cascading to saveOrUpdate: org.hibernate.test.subclassbagofsibling.Authorization
persistent instance of: org.hibernate.test.subclassbagofsibling.Authorization
ignoring persistent instance
object already associated with session: [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A3, documentType=AUTH, key2=A}]
done cascade ACTION_SAVE_UPDATE for collection: org.hibernate.test.subclassbagofsibling.Voucher.authorizations
deleting orphans for collection: org.hibernate.test.subclassbagofsibling.Voucher.authorizations
done deleting orphans for collection: org.hibernate.test.subclassbagofsibling.Voucher.authorizations
done processing cascade ACTION_SAVE_UPDATE for: org.hibernate.test.subclassbagofsibling.Voucher
dirty checking collections
Flushing entities and processing referenced collections
Collection found: [org.hibernate.test.subclassbagofsibling.Voucher.authorizations#1], was: [<unreferenced>] (initialized)
Processing unreferenced collections
Scheduling collection removes/(re)creates/updates
Flushed: 4 insertions, 0 updates, 0 deletions to 4 objects
Flushed: 1 (re)creations, 0 updates, 0 removals to 1 collections
listing entities:
org.hibernate.test.subclassbagofsibling.Authorization{groupId=1, documentKey=component[key1,key2,documentType]{key1=A3, documentType=AUTH, key2=A}}
org.hibernate.test.subclassbagofsibling.Authorization{groupId=1, documentKey=component[key1,key2,documentType]{key1=A2, documentType=AUTH, key2=A}}
org.hibernate.test.subclassbagofsibling.Authorization{groupId=1, documentKey=component[key1,key2,documentType]{key1=A1, documentType=AUTH, key2=A}}
org.hibernate.test.subclassbagofsibling.Voucher{groupId=1, authorizations=[org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A1, documentType=AUTH, key2=A}, org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A2, documentType=AUTH, key2=A}, org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A3, documentType=AUTH, key2=A}], documentKey=component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}}
executing flush
Inserting entity: [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
insert into VOUCHER (GROUPID, colKey1, colKey2, DOCTYPE) values (?, ?, ?, ?)
preparing statement
Dehydrating entity: [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
binding '1' to parameter: 1
binding 'A' to parameter: 2
binding 'A' to parameter: 3
binding 'VCH' to parameter: 4
Adding to batch
Inserting entity: [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A1, documentType=AUTH, key2=A}]
reusing prepared statement
insert into VOUCHER (GROUPID, colKey1, colKey2, DOCTYPE) values (?, ?, ?, ?)
Dehydrating entity: [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A1, documentType=AUTH, key2=A}]
binding '1' to parameter: 1
binding 'A1' to parameter: 2
binding 'A' to parameter: 3
binding 'AUTH' to parameter: 4
Adding to batch
Inserting entity: [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A2, documentType=AUTH, key2=A}]
reusing prepared statement
insert into VOUCHER (GROUPID, colKey1, colKey2, DOCTYPE) values (?, ?, ?, ?)
Dehydrating entity: [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A2, documentType=AUTH, key2=A}]
binding '1' to parameter: 1
binding 'A2' to parameter: 2
binding 'A' to parameter: 3
binding 'AUTH' to parameter: 4
Adding to batch
Inserting entity: [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A3, documentType=AUTH, key2=A}]
reusing prepared statement
insert into VOUCHER (GROUPID, colKey1, colKey2, DOCTYPE) values (?, ?, ?, ?)
Dehydrating entity: [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A3, documentType=AUTH, key2=A}]
binding '1' to parameter: 1
binding 'A3' to parameter: 2
binding 'A' to parameter: 3
binding 'AUTH' to parameter: 4
Adding to batch
Executing batch size: 4
about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
closing statement
Inserting collection: [org.hibernate.test.subclassbagofsibling.Voucher.authorizations#1]
about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
update VOUCHER set GROUPID=? where colKey1=? and colKey2=? and DOCTYPE=?
preparing statement
binding '1' to parameter: 1
binding 'A1' to parameter: 2
binding 'A' to parameter: 3
binding 'AUTH' to parameter: 4
Adding to batch
reusing prepared statement
update VOUCHER set GROUPID=? where colKey1=? and colKey2=? and DOCTYPE=?
binding '1' to parameter: 1
binding 'A2' to parameter: 2
binding 'A' to parameter: 3
binding 'AUTH' to parameter: 4
Adding to batch
reusing prepared statement
update VOUCHER set GROUPID=? where colKey1=? and colKey2=? and DOCTYPE=?
binding '1' to parameter: 1
binding 'A3' to parameter: 2
binding 'A' to parameter: 3
binding 'AUTH' to parameter: 4
Adding to batch
done inserting collection: 3 rows inserted
Invalidating: org.hibernate.test.subclassbagofsibling.Voucher.authorizations#1
Executing batch size: 3
about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
closing statement
post flush
before transaction completion
before transaction completion
committed JDBC Connection
after transaction completion
aggressively releasing JDBC connection
closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
returning connection to pool, pool size: 1
after transaction completion
Invalidating (again): org.hibernate.test.subclassbagofsibling.Voucher.authorizations#1
closing session 24248500
connection already null in cleanup : no action
opened session 15595312 at timestamp: 4689316617650176
begin
opening JDBC connection
total checked-out connections: 0
using pooled JDBC connection, pool size: 0
current autocommit status: false
after transaction begin
loading entity: [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
creating new proxy for entity
initializing proxy: [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
attempting to resolve: [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
Cache lookup: org.hibernate.test.subclassbagofsibling.BaseDocument#org.hibernate.test.subclassbagofsibling.DocumentKey@14bbd
Cache miss
object not resolved in any cache: [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
Fetching entity: [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
loading entity: [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
select voucher0_.colKey1 as colKey1_0_0_, voucher0_.colKey2 as colKey2_0_0_, voucher0_.DOCTYPE as DOCTYPE0_0_, voucher0_.GROUPID as GROUPID0_0_ from VOUCHER voucher0_ where voucher0_.colKey1=? and voucher0_.colKey2=? and voucher0_.DOCTYPE=? and voucher0_.DOCTYPE='VCH'
preparing statement
binding 'A' to parameter: 1
binding 'A' to parameter: 2
binding 'VCH' to parameter: 3
about to open ResultSet (open ResultSets: 0, globally: 0)
processing result set
result set row: 0
result row: EntityKey[org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
Initializing object from ResultSet: [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
Hydrating entity: [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
returning '1' as column: GROUPID0_0_
done processing result set (1 rows)
about to close ResultSet (open ResultSets: 1, globally: 1)
about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
closing statement
total objects hydrated: 1
resolving associations for [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
creating collection wrapper:[org.hibernate.test.subclassbagofsibling.Voucher.authorizations#1]
adding entity to second-level cache: [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
Caching: org.hibernate.test.subclassbagofsibling.BaseDocument#org.hibernate.test.subclassbagofsibling.DocumentKey@14bbd
done materializing entity [org.hibernate.test.subclassbagofsibling.Voucher#component[key1,key2,documentType]{key1=A, documentType=VCH, key2=A}]
done entity load
initializing collection [org.hibernate.test.subclassbagofsibling.Voucher.authorizations#1]
checking second-level cache
Cache lookup: org.hibernate.test.subclassbagofsibling.Voucher.authorizations#1
Cache miss
collection not cached
loading collection: [org.hibernate.test.subclassbagofsibling.Voucher.authorizations#1]
about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
select authorizat0_.GROUPID as GROUPID1_, authorizat0_.colKey1 as colKey1_1_, authorizat0_.colKey2 as colKey2_1_, authorizat0_.DOCTYPE as DOCTYPE1_, authorizat0_.colKey1 as colKey1_0_0_, authorizat0_.colKey2 as colKey2_0_0_, authorizat0_.DOCTYPE as DOCTYPE0_0_, authorizat0_.GROUPID as GROUPID0_0_ from VOUCHER authorizat0_ where authorizat0_.DOCTYPE='AUTH' and authorizat0_.GROUPID=?
preparing statement
binding '1' to parameter: 1
about to open ResultSet (open ResultSets: 0, globally: 0)
result set contains (possibly empty) collection: [org.hibernate.test.subclassbagofsibling.Voucher.authorizations#1]
getLoadingCollection(): key=CollectionKey[org.hibernate.test.subclassbagofsibling.Voucher.authorizations#1], entry=null
uninitialized collection: initializing
processing result set
result set row: 0
returning 'A1' as column: colKey1_0_0_
returning 'A' as column: colKey2_0_0_
returning 'AUTH' as column: DOCTYPE0_0_
result row: EntityKey[org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A1, documentType=AUTH, key2=A}]
Initializing object from ResultSet: [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A1, documentType=AUTH, key2=A}]
Hydrating entity: [org.hibernate.test.subclassbagofsibling.Authorization#component[key1,key2,documentType]{key1=A1, documentType=AUTH, key2=A}]
returning '1' as column: GROUPID0_0_
returning '1' as column: GROUPID1_
found row of collection: [org.hibernate.test.subclassbagofsibling.Voucher.authorizations#1]
IllegalArgumentException in class: org.hibernate.test.subclassbagofsibling.DocumentKey, getter method of property: key1
about to close ResultSet (open ResultSets: 1, globally: 1)
about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
closing statement
closing session 15595312
performing cleanup
closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
returning connection to pool, pool size: 1
closing
cleaning up connection pool: jdbc:mysql:///test
Running hbm2ddl schema export
import file not found: /import.sql
exporting generated schema to database
total checked-out connections: 0
opening new JDBC connection
created connection to: jdbc:mysql:///test, Isolation Level: 4
drop table if exists VOUCHER
schema export complete
returning connection to pool, pool size: 1


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 11:03 am 
Newbie

Joined: Tue Apr 11, 2006 1:28 pm
Posts: 6
I am not an expert, but you have not supplied a type in the property of the map file.

<key-property name="key1" column="colKey1" type="string"/>

Note: IllegalArgumentException occurred calling getter of org.hibernate.test.subclassbagofsibling.DocumentKey.key1


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 11:14 am 
Newbie

Joined: Fri Feb 06, 2004 1:37 pm
Posts: 9
Mike,

That's certainly a good suggestion, I have tried that and still the same error. I beleive that the ClassCast is actually the key itself, not the attribute. In this case I believe its trying to cast org.hibernate.test.subclassbagofsibling.BaseDocument to org.hibernate.test.subclassbagofsibling.DocumentKey.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 18, 2006 7:47 pm 
Newbie

Joined: Thu May 18, 2006 6:59 pm
Posts: 1
I'm having what I believe is this exact problem. I'm new to hibernate and thought that maybe I was getting something wrong, but from everything I've read, I'm doing everything correct and hibernate is making a mistake.


I have 4 classes:
Code:
public abstract class Question<T extends Answer> {
   
   private long id;
   private String description = "";
   private SortedSet<T> answers = null;
   
   /**
    * @return Returns the answers.
    */
   public SortedSet<T> getAnswers() {
      if(answers == null) answers = new TreeSet<T>();
      return answers;
   }
   public void setAnswers(SortedSet<T> answers ) { this.answers = answers; }
   
   public String getDescription() { return description; }
   public void setDescription(String description ) { this.description = description; }
   
   public long getId() { return id; }
   public void setId(long id ) { this.id = id; }
   
}

----------------------
Code:
public class SliderQuestion extends Question<SliderAnswer> {
   
   private String text;
   
   public String getText() { return text; }
   public void setText(String text ) { this.text = text; }
}


----------------------
Code:
public abstract class Response<T extends Question> {
   private long id;
   private User user;
   private Survey survey;
   private T question;
   
   public long getId() { return id; }
   public void setId(long id ) { this.id = id; }
   
   public T getQuestion() { return question; }
   public void setQuestion(T question ) { this.question = question; }
   
   public Survey getSurvey() { return survey; }
   public void setSurvey(Survey survey ) { this.survey = survey; }
   
   public User getUser() { return user; }
   public void setUser(User user ) { this.user = user; }
}

----------------------
Code:
public class SliderResponse extends Response<SliderQuestion> {
   
   private SliderAnswer sliderAnswer;
   private float value;

   public float getValue() { return value; }
   public void setValue(float value ) { this.value = value; }

   public SliderAnswer getSliderAnswer() { return sliderAnswer; }
   public void setSliderAnswer(SliderAnswer sliderAnswer ) { this.sliderAnswer = sliderAnswer; }
}

----------------------

The classes are mapped thusly:

Question.hbm.xml
Code:
<hibernate-mapping>
   <class name="package.Question" table="question">
      <id name="id" column="question_id">
         <generator class="identity" />
      </id>
      <property name="description" />
      
      <set name="answers" table="question_answer" sort="natural" cascade="all">
           <key column="question_id" />
         <many-to-many column="answer_id" class="package.Answer"/>
      </set>
      
      <!--  now define the various subclasses -->
      <joined-subclass name="package.SliderQuestion" table="slider_question">
         <key column="question_id" />
         <property name="text" column="slider_question_text" />
      </joined-subclass>
   </class>
</hibernate-mapping>


---------------------------------

Response.hbm.xml
Code:
<hibernate-mapping>
   <!--  now map the survey class -->
   <class name="package.Response" table="response">
      <id name="id" column="response_id">
         <generator class="identity" />
      </id>
      
      <many-to-one cascade="all" column="username" name="user" class="package.User" />
      <many-to-one cascade="all" column="survey_id" name="survey" class="package.Survey" />
      <many-to-one cascade="all" column="question_id" name="question" class="package.Question" />
      
      <joined-subclass name="package.SliderResponse" table="slider_response">
         <key column="response_id" />
         <property name="value" column="response_value" type="float" />
         <many-to-one cascade="all" column="answer_id" name="sliderAnswer" class="package.SliderAnswer" />
      </joined-subclass>
   </class>
</hibernate-mapping>


--------------------------------


It seems reasonably straightforward, I think.

You can see that in the "Question" implimentation, I added the generics code "Response<T extends Question>" to try and force hibernate to make sure that the type of "SliderResponse.getQuestion()" would be "SliderQuestion". Indeed its not actually possible for code that doesn't set the "question" value as a "SliderQuestion" to compile!

But when I run the following:

Code:
session.beginTransaction();
SliderResponse r = (SliderResponse) session.load(SliderResponse.class, 4l);
System.out.println("Response from "+r.getUser().getUsername());
System.out.println("Question: "+r.getQuestion().getText());
System.out.println("Answer: "+r.getSliderAnswer().getLabel());
session.getTransaction().commit();


I get the output:

Code:
Response from subject
Exception in thread "main" java.lang.ClassCastException: package.Question$$EnhancerByCGLIB$$eb29ef7f


As you can see, hibernate is returning an Instance of Question, rather than SliderQuestion, my generics code is actually making "r.getQuestion()" fail because its returning the wrong type!

If I remove the line to get the following test code:
Code:
session.beginTransaction();
SliderResponse r = (SliderResponse) session.load(SliderResponse.class, 4l);
System.out.println("Response from "+r.getUser().getUsername());
//System.out.println("Question: "+r.getQuestion().getText());
System.out.println("Answer: "+r.getSliderAnswer().getLabel());
session.getTransaction().commit();


Then it will execute fine, the call to "getSliderAnswer" works fine (even though SliderAnswer is also a subclass of Answer).


I'm pulling my hair out over this, I think the problem lies in the fact that I have defined the <many-to-one> relationship using the Question class, but my understanding is that hibernate should handle the polymorphism and return me the true Type of the object that was originally saved.
So either there is a mapping subtlety that I haven't discovered yet, or this is a bug in hibernate.


I apologise for the length of this response, but I see you only posted this a few days ago, and I'm hoping that we can help each other out here.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.