Entity Mapping issue in Hibernate 5.2.10

Description

Hibernate is not able to resolve Entity Mappings for Association Attributes. I took a simple self join example and tried to build the sessionFactory using hbm.xml file. The same code works fine on Hibernate 4.3 but throws the following exception in Hibernate 5.2 :

java.lang.IllegalArgumentException: Expecting collection type [org.hibernate.type.BagType] at org.hibernate.metamodel.internal.AttributeFactory.determineCollectionType(AttributeFactory.java:930) at org.hibernate.metamodel.internal.AttributeFactory$PluralAttributeMetadataImpl.(AttributeFactory.java:779) at org.hibernate.metamodel.internal.AttributeFactory$PluralAttributeMetadataImpl.(AttributeFactory.java:760) at org.hibernate.metamodel.internal.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:541) at org.hibernate.metamodel.internal.AttributeFactory.buildAttribute(AttributeFactory.java:77) at org.hibernate.metamodel.internal.MetadataContext.wrapUp(MetadataContext.java:213) at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:220) at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:295) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710) at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.buildSessionFactory(BaseCoreFunctionalTestCase.java:107) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.hibernate.testing.junit4.TestClassMetadata.performCallbackInvocation(TestClassMetadata.java:200) at org.hibernate.testing.junit4.TestClassMetadata.invokeCallback(TestClassMetadata.java:187) at org.hibernate.testing.junit4.TestClassMetadata.performCallbacks(TestClassMetadata.java:181) at org.hibernate.testing.junit4.TestClassMetadata.performBeforeClassCallbacks(TestClassMetadata.java:172) at org.hibernate.testing.junit4.BeforeClassCallbackHandler.evaluate(BeforeClassCallbackHandler.java:25) at org.hibernate.testing.junit4.AfterClassCallbackHandler.evaluate(AfterClassCallbackHandler.java:25) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

The discussion related to the problem is @ https://forum.hibernate.org/viewtopic.php?f=1&t=1044389
As per the team request, i have also added the test-case using JPA test-case template @
https://github.com/hibernate/hibernate-test-case-templates/pull/19

Let me know if you need any other details.

Activity

Christian BeikovJanuary 24, 2025 at 3:03 PM

Closing since this is using a custom tuplizer which was removed in ORM 6.

Ashudeep SharmaJune 15, 2017 at 2:57 PM
Edited

@crancran , this issue is a blocker for us as we can no longer use the latest version of Hibernate ORM. Can you please let me know if there are any workarounds for this?

Rejected

Details

Assignee

Reporter

Labels

Worked in

Components

Affects versions

Priority

Created June 15, 2017 at 2:14 AM
Updated January 24, 2025 at 3:03 PM
Resolved January 24, 2025 at 3:03 PM

Flag notifications