Skip to content

Instantly share code, notes, and snippets.

@stliu
Created July 23, 2012 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stliu/3164408 to your computer and use it in GitHub Desktop.
Save stliu/3164408 to your computer and use it in GitHub Desktop.
Hibernate:
select
notes0_.text_id as text1_0_0_,
notes0_.text_part as text2_0_
from
NOTE notes0_
where
notes0_.text_id=?
00:00:49,168 TRACE LongType:150 - binding '2' to parameter: 1
00:00:49,187 TRACE LongType:192 - returning '2' as column: text1_0_0_
00:00:49,209 WARN LoadContexts:131 - fail-safe cleanup (collections) : org.hibernate.engine.loading.CollectionLoadContext@22b3428e<rs=com.mysql.jdbc.JDBC4ResultSet@5fea6729>
00:00:49,210 WARN CollectionLoadContext:372 - On CollectionLoadContext#cleanup, localLoadingCollectionKeys contained [1] entries
00:00:49,211 INFO SessionFactoryImpl:854 - closing
00:00:49,212 INFO DriverManagerConnectionProvider:170 - cleaning up connection pool: jdbc:mysql://localhost/hibernate
org.hibernate.PropertyAccessException: could not get a field value by reflection getter of org.hibernate.test.annotations.cid.DoesNotWorkPk.id1
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:58)
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:697)
at org.hibernate.loader.Loader.readCollectionElement(Loader.java:1201)
at org.hibernate.loader.Loader.readCollectionElements(Loader.java:811)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:654)
at org.hibernate.loader.Loader.doQuery(Loader.java:867)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:298)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:280)
at org.hibernate.loader.Loader.loadCollection(Loader.java:2206)
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:1787)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:366)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:131)
at org.hibernate.collection.PersistentBag.size(PersistentBag.java:248)
at org.hibernate.test.annotations.cid.HHH6024Test.testDoesNotWorks(HHH6024Test.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.hibernate.test.annotations.HibernateTestCase.runTest(HibernateTestCase.java:93)
at org.hibernate.test.annotations.HibernateTestCase.runBare(HibernateTestCase.java:81)
at com.intellij.junit3.JUnit3IdeaTestRunner.doRun(JUnit3IdeaTestRunner.java:139)
at com.intellij.junit3.JUnit3IdeaTestRunner.startRunnerWithArgs(JUnit3IdeaTestRunner.java:52)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.IllegalArgumentException: Can not set java.lang.String field org.hibernate.test.annotations.cid.DoesNotWorkPk.id1 to org.hibernate.test.annotations.cid.DoesNotWork
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168)
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:55)
at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36)
at java.lang.reflect.Field.get(Field.java:372)
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:55)
... 46 more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment