Hibernate ORM
  1. Hibernate ORM
  2. HHH-7714

Add support for EntityMode.MAP to JPA Criteria API

    Details

    • Requires Release Note:
      Affirmative
    • Last commented by a user?:
      true
    • Suitable for new contributors:
      Yes, likely

      Description

      According to the documentation, the old Hibernate criteria API is deprecated and the JPA criteria API should be used in its place. Unfortunately the Hibernate implementation of the JPA criteria API doesn't support EntityMode.MAP. This prevents developers from using JPA criteria queries for dynamic systems (systems which don't use classes to represent types).

      I've created a branch in GitHub (https://github.com/koehn/hibernate-orm) to address this issue. It allows developers to use EntityTypes and names to look up types and properties, respectively. The developer can then create a Hibernate configuration with PersistentClasses, Tuplizers, InstanceAccessors, etc. which may be used with the JPA Criteria API.

      Note that the implementation doesn't require the use of Map as the type to represent a type. The existing code makes some strong assumptions that Map implementations must represent the type.

        Issue Links

          Activity

          Hide
          Steve Ebersole added a comment -

          Not sure what to tell you. People and CI servers run this build fine every day on many of those same set ups. So I don't think it is environment problem.

          Btw, as I pointed out before, I cannot guarantee this "feature" wont regress (especially in the short term) because there are no real tests for it. In fact, the test you added passed even though building this JPA metamodel clearly fails in most/all situations with MAP entity-mode prior to my changes from today.

          Show
          Steve Ebersole added a comment - Not sure what to tell you. People and CI servers run this build fine every day on many of those same set ups. So I don't think it is environment problem. Btw, as I pointed out before, I cannot guarantee this "feature" wont regress (especially in the short term) because there are no real tests for it. In fact, the test you added passed even though building this JPA metamodel clearly fails in most/all situations with MAP entity-mode prior to my changes from today.
          Hide
          Brad Koehn added a comment -

          I can add some additional tests if needed. I have a small suite that I used as a proof of concept that I could generify for this.

          Show
          Brad Koehn added a comment - I can add some additional tests if needed. I have a small suite that I used as a proof of concept that I could generify for this.
          Hide
          Steve Ebersole added a comment -

          That would be immensely helpful

          Show
          Steve Ebersole added a comment - That would be immensely helpful
          Hide
          Brad Koehn added a comment -

          Pull request submitted. It's a big test, but it pretty thoroughly exercises the system.

          Show
          Brad Koehn added a comment - Pull request submitted. It's a big test, but it pretty thoroughly exercises the system.
          Hide
          Harry Cummings added a comment -

          Great. I have a hard time with the build because I always get the following errors, whether on Cygwin, Windows 7, or OS X.
          [snip]
          :hibernate-core:test
          org.hibernate.test.fileimport.CommandExtractorServiceTest > testImportFile FAILED
          org.junit.ComparisonFailure
          org.hibernate.test.fileimport.MultiLineImportFileTest > testImportFile FAILED
          org.junit.ComparisonFailure at MultiLineImportFileTest.java:78
          3740 tests completed, 2 failed, 115 skipped

          I've raised a ticket for this and a pull request to fix it: HHH-8397

          Show
          Harry Cummings added a comment - Great. I have a hard time with the build because I always get the following errors, whether on Cygwin, Windows 7, or OS X. [snip] :hibernate-core:test org.hibernate.test.fileimport.CommandExtractorServiceTest > testImportFile FAILED org.junit.ComparisonFailure org.hibernate.test.fileimport.MultiLineImportFileTest > testImportFile FAILED org.junit.ComparisonFailure at MultiLineImportFileTest.java:78 3740 tests completed, 2 failed, 115 skipped I've raised a ticket for this and a pull request to fix it: HHH-8397

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 336h Original Estimate - 336h
                336h
                Remaining:
                Time Spent - 3h 28m Remaining Estimate - 336h
                336h
                Logged:
                Time Spent - 3h 28m Remaining Estimate - 336h
                3h 28m

                  Development