[hibernate-issues] [JIRA] (HHH-14069) LazyLoad with singleTable inheritance don't use discriminatorValue

Florian Kern (JIRA) jira at hibernate.atlassian.net
Fri Jun 12 06:01:43 EDT 2020


Florian Kern ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5ee102ca96beaa0aae0970ea ) *updated* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYmJkYjEzYWI0ZTk2NDgyMjhkZWU0NTIxYWUzM2NiMjYiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-14069?atlOrigin=eyJpIjoiYmJkYjEzYWI0ZTk2NDgyMjhkZWU0NTIxYWUzM2NiMjYiLCJwIjoiaiJ9 ) HHH-14069 ( https://hibernate.atlassian.net/browse/HHH-14069?atlOrigin=eyJpIjoiYmJkYjEzYWI0ZTk2NDgyMjhkZWU0NTIxYWUzM2NiMjYiLCJwIjoiaiJ9 ) LazyLoad with singleTable inheritance don't use discriminatorValue ( https://hibernate.atlassian.net/browse/HHH-14069?atlOrigin=eyJpIjoiYmJkYjEzYWI0ZTk2NDgyMjhkZWU0NTIxYWUzM2NiMjYiLCJwIjoiaiJ9 )

Change By: Florian Kern ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5ee102ca96beaa0aae0970ea )

please see the attached test case , In later situations a org. hibernate.WrongClassException

With singleTable inheritance lazyLoad is thrown triggered , because of without the discriminator value in the first loaded Collection SQL Statement. In consequence there are a wrong mapped object.

org.hibernate.WrongClassException: Object [id=1] was not of objects in the specified subclass [eu collection. pinske.model.Child2] : loaded object was of In the later, if the entityManager knows the wrong class class eu.pinske.model.Child1
at org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl.hydrateEntityState(EntityReferenceInitializerImpl.java:195)
at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.readRow(AbstractRowReader.java:109)
at org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl.extractResults(ResultSetProcessorImpl.java:124)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:105)
at org.hibernate.loader. mapped object and the secound collection.plan.AbstractLoadPlanBasedCollectionInitializer.initialize(AbstractLoadPlanBasedCollectionInitializer.java:87)
at triggerLazy load, there is a org.hibernate. persister WrongClassException thrown. collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:710)
at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:76)
at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:102)
at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:2161)
at org.hibernate.collection.internal.AbstractPersistentCollection$4.doWork(AbstractPersistentCollection.java:589)
at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:264)
at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:585)
at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:149)
at org.hibernate.collection.internal.PersistentSet.iterator(PersistentSet.java:188)
at eu.pinske.test.ThingTest.test(ThingTest.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)

( https://hibernate.atlassian.net/browse/HHH-14069#add-comment?atlOrigin=eyJpIjoiYmJkYjEzYWI0ZTk2NDgyMjhkZWU0NTIxYWUzM2NiMjYiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-14069#add-comment?atlOrigin=eyJpIjoiYmJkYjEzYWI0ZTk2NDgyMjhkZWU0NTIxYWUzM2NiMjYiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100128- sha1:14a4bff )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200612/13ce5544/attachment.html 


More information about the hibernate-issues mailing list