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* :
{quote} 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. <init> (AttributeFactory.java:779) at org.hibernate.metamodel.internal.AttributeFactory$PluralAttributeMetadataImpl. <init> (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. <init> (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) {quote}
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.
|
|