Hibernate ORM
  1. Hibernate ORM
  2. HHH-8501

Improve hibernate-osgi support in ORM 5

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 5.0.0
    • Component/s: None
    • Labels:
      None
    • Last commented by a user?:
      true

      Description

      The OSGi documentation lists many caveats present when using hibernate-osgi in ORM 4.2 or 4.3. Many of them are due to architectural constraints within ORM, but several involve 3rd party containers/libraries.

      This ticket will track subtasks that attempt to mitigate these caveats in ORM 5.

      Technically, multiple persistence units are supported by Enterprise OSGi JPA and unmanaged Hibernate JPA use. However, we cannot currently support this in OSGi. In Hibernate 4, only one instance of the OSGi-specific ClassLoader is used per Hibernate bundle, mainly due to heavy use of static TCCL utilities. We hope to support one OSGi ClassLoader per persistence unit in Hibernate 5.

      Some containers (ex: Aries) always return true for PersistenceUnitInfo#excludeUnlistedClasses, even if your persistence.xml explicitly has exclude-unlisted-classes set to false. They claim it's to protect JPA providers from having to implement scanning ("we handle it for you"), even though we still want to support it in many cases. The work around is to set hibernate.archive.autodetection to, for example, hbm,class. This tells hibernate to ignore the excludeUnlistedClasses value and scan for *.hbm.xml and entities regardless.

      Scanning does not currently support annotated packages on package-info.java.

      The environment should be considered STATIC. Hibernate currently does not support the ability to dynamically add and remove client bundles during runtime. Doing so is typically catastrophic. We hope to better support at least partially-dynamic environments in Hibernate 5.

      In addition:

      • Investigate whether or not Aries (and other containers) support scanning explicitly-listed jars

        Issue Links

          Activity

          Hide
          De Gaia added a comment -

          Hi Brett! After many conversation with Peter i was able to get access to his latest tutorial concerning JPA, with Hibernate and OSGi. You can have access to the link to get some inspiration and maybe ask specific questions to him. He told me also that he will adapt the example with the latest version of Hibernate. Since this example is with Hibernate 3.18.

          Anyway it would be very good to have your feedback about his work.

          Thank you

          https://github.com/osgi/osgi.enroute.blog/tree/master

          Show
          De Gaia added a comment - Hi Brett! After many conversation with Peter i was able to get access to his latest tutorial concerning JPA, with Hibernate and OSGi. You can have access to the link to get some inspiration and maybe ask specific questions to him. He told me also that he will adapt the example with the latest version of Hibernate. Since this example is with Hibernate 3.18. Anyway it would be very good to have your feedback about his work. Thank you https://github.com/osgi/osgi.enroute.blog/tree/master

            People

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

              Dates

              • Created:
                Updated:

                Development