Uploaded image for project: 'Hibernate ORM'
  1. HHH-8895

Filter for MappedSuperClass stopped to work from 4.1.6.Final

    Details

    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      A hibernate filter defined on a @MappedSuperclass causes SQLGrammarException if SELECT statement is executed from Entity which indirectly inherits from the @MappedSuperclass.

      For example, given the following classes:

      @MappedSuperclass class ABase {}
      @Entity class A extends ABase {}
      @Entity class B extends A {}
      

      the following JPQL query

      SELECT b FROM B b
      

      fails with the following exception:

      javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: Column "B0_.FOO" not found; SQL statement:
      select b0_.id as id6_, b0_1_.foo as foo6_, case when b0_2_.id is not null then 2 when b0_.id is not null then 1 end as clazz_ from B b0_ inner join A b0_1_ on b0_.id=b0_1_.id left outer join C b0_2_ on b0_.id=b0_2_.id where ? = b0_.foo and ? = b0_1_.foo [42122-170]
      ...
      

      According to https://hibernate.atlassian.net/browse/HHH-4332 and https://hibernate.atlassian.net/browse/HHH-123 the filter inheritance should work from version 3.x.

      Indeed this has worked in the version 4.1.5.Final. But from the version 4.1.6.Final it has stopped working. The same error also occurs in the latest release (4.3.1.Final).

      Propbably the issue https://hibernate.atlassian.net/browse/HHH-8033 is releated to this.

      The attached test case is a Maven project containing tests for the example above.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: