[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3601) composite-id and association with property-ref causing PropertyAccessException

Anthony Patricio (JIRA) noreply at atlassian.com
Thu Nov 13 04:48:16 EST 2008


composite-id and association with property-ref causing PropertyAccessException
------------------------------------------------------------------------------

                 Key: HHH-3601
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3601
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.1
            Reporter: Anthony Patricio
         Attachments: CidAndPropertyRefBug.zip

Order has a composite id
We also have Order OneToMany LineItem using a property-ref, see attached testcase (build from 3.3.1 core test suite project)

when trying to load the collection, following exception is raised
10:35:50,046 ERROR BasicPropertyAccessor:191 - IllegalArgumentException in class: org.hibernate.test.cid.propertyref.Order$Id, getter method of property: customerId
org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of org.hibernate.test.cid.propertyref.Order$Id.customerId
	at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:195)
	at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValue(AbstractComponentTuplizer.java:87)
	at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValues(AbstractComponentTuplizer.java:93)
	at org.hibernate.tuple.component.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:109)
	at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:376)
	at org.hibernate.type.ComponentType.getHashCode(ComponentType.java:207)
	at org.hibernate.engine.EntityKey.generateHashCode(EntityKey.java:126)
	at org.hibernate.engine.EntityKey.<init>(EntityKey.java:70)
	at org.hibernate.engine.StatefulPersistenceContext.getCollectionOwner(StatefulPersistenceContext.java:701)
	at org.hibernate.loader.Loader.readCollectionElement(Loader.java:1016)
	at org.hibernate.loader.Loader.readCollectionElements(Loader.java:669)
	at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:614)
	at org.hibernate.loader.Loader.doQuery(Loader.java:724)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
	at org.hibernate.loader.Loader.loadCollection(Loader.java:2015)
	at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:59)
	at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:587)
	at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
	at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1743)
	at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:476)
	at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:867)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:264)
	at org.hibernate.loader.Loader.doList(Loader.java:2228)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
	at org.hibernate.loader.Loader.list(Loader.java:2120)
	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
	at org.hibernate.test.cid.propertyref.CompositeIdTest.testQuery(CompositeIdTest.java:59)
	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.junit.functional.FunctionalTestCase.runTest(FunctionalTestCase.java:125)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at org.hibernate.junit.UnitTestCase.runBare(UnitTestCase.java:63)
	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 org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
	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 org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:169)
	... 48 more


May be the same source as 
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2843
where user is reporting
"I think this is a bug. After adding some extra debugging to the hibernate code, Hibernate is passing in an array of of the properties and trying to call the getter on the array instead of the containing object. "

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list