Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-3503

Incompatiblity introduced, org.hibernate.MappingException is thrown in Hibernate 5.0.4+

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • 7.0.0.ER7
    • 7.0.0.ER2 (Beta)
    • Hibernate
    • None
    • Fixed in 5.0.9.Final.
    • Hide

      1. Copy the attached files, InheritedCollectionTestV{1,2}.java , to ./hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/ of Hibernate ORM distribution (or our hibernate-core.git repository).
      2. Run the test in each version, 5.0.3 and 5.0.4: ./gradlew hibernate-entitymanager:test -Dtest.single="InheritedCollectionTest*"

      Show
      1. Copy the attached files, InheritedCollectionTestV{1,2}.java , to ./hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/ of Hibernate ORM distribution (or our hibernate-core.git repository). 2. Run the test in each version, 5.0.3 and 5.0.4: ./gradlew hibernate-entitymanager:test -Dtest.single="InheritedCollectionTest*"

    Description

      Attached test case, InheritedCollectionTestV1.java was working fine in Hibernate ORM 5.0.3 but it started to throw org.hibernate.MappingException from version 5.0.4 (the same in the current master as well). It seems HHH-5948 introduced an incompatibility.

      InheritedCollectionTestV1 failed in version 5.0.4
      org.hibernate.MappingException: Unknown collection role: org.hibernate.jpa.test.criteria.InheritedCollectionTestV1$Customer.roles
      	at org.hibernate.internal.SessionFactoryImpl.getCollectionPersister(SessionFactoryImpl.java:825)
      	at org.hibernate.jpa.criteria.path.PluralAttributePath.resolvePersister(PluralAttributePath.java:40)
      	at org.hibernate.jpa.criteria.path.PluralAttributePath.<init>(PluralAttributePath.java:35)
      	at org.hibernate.jpa.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:149)
      	at org.hibernate.jpa.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:185)
      	at org.hibernate.jpa.test.criteria.InheritedCollectionTestV1.findCustomerByRole(InheritedCollectionTestV1.java:53)
      	at org.hibernate.jpa.test.criteria.InheritedCollectionTestV1.test1(InheritedCollectionTestV1.java:38)
      	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:497)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      	at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)
      

      While InheritedCollectionTestV2.java, which removes @Entity and adds @MappedSuperclass to a base class, works fine with version 5.0.4 but this doesn't work with version 5.0.3. The stack trace is exactly the same.

      InheritedCollectionTestV2 failed in version 5.0.3
      org.hibernate.MappingException: Unknown collection role: org.hibernate.jpa.test.criteria.InheritedCollectionTestV2$UserBase.roles
      	at org.hibernate.internal.SessionFactoryImpl.getCollectionPersister(SessionFactoryImpl.java:825)
      	at org.hibernate.jpa.criteria.path.PluralAttributePath.resolvePersister(PluralAttributePath.java:40)
      	at org.hibernate.jpa.criteria.path.PluralAttributePath.<init>(PluralAttributePath.java:35)
      	at org.hibernate.jpa.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:149)
      	at org.hibernate.jpa.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:185)
      	at org.hibernate.jpa.test.criteria.InheritedCollectionTestV2.findCustomerByRole(InheritedCollectionTestV2.java:54)
      	at org.hibernate.jpa.test.criteria.InheritedCollectionTestV2.test1(InheritedCollectionTestV2.java:39)
      	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:497)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      	at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)
      

      Does the customer need to rewrite their code to fit the new version, or an unexpected incompatibility is introduced?

      Attachments

        Issue Links

          Activity

            People

              gbadner@redhat.com Gail Badner (Inactive)
              rhn-support-onagano Osamu Nagano
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: