[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5812) OSGi support

Harald Wellmann (JIRA) noreply at atlassian.com
Sat Jun 11 07:27:25 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42567#action_42567 ] 

Harald Wellmann commented on HHH-5812:
--------------------------------------

I support this request: OSGi support in Hibernate is long overdue. Eclipselink, OpenJPA and DataNucleus embrace OSGi to varying degrees, while Hibernate doesn't, see [this article|http://hwellmann.blogspot.com/2010/09/osgi-support-in-jpa-20-persistence.html]  for a review.

Note that packaging Hibernate and its dependencies as OSGi bundles is only the tip of the iceberg and the easiest part of the story. The hardest part is to get the classloading right - Hibernate will have to load classes from user bundles which is not possible via the bundle class loader by default. Using Dynamic-ImportPackage, which is what many people do to make it work, is rather a dirty hack from the OSGi perspective.

Last time I looked at the Hibernate sources, there were quite a few occurrences of Class.forName() depending on the ThreadContextClassLoader, which simply won't work in OSGi, so for becoming a good OSGi citizen, Hibernate will require some changes in its core.

The OSGi Enterprise Spec 4.2 includes an OSGi JPA service defining a contract both for persistence providers and persistence bundles (i.e. user bundles containing a persistence unit) to work together in an OSGi environment, both for managed (Java EE) and unmanaged (Java SE) persistence units. Apache Aries is closest to a reference implementation of this spec, tested with OpenJPA.

So OSGi support in Hibernate should also cover the persistence provider part of the OSGi JPA spec.

If there is serious interest in the Hibernate core team to address this issue, I volunteer for more detailed discussions or even code contributions.




> OSGi support
> ------------
>
>                 Key: HHH-5812
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5812
>             Project: Hibernate Core
>          Issue Type: New Feature
>          Components: core
>    Affects Versions: 3.6.0
>            Reporter: Rice Yeh
>
> Beacause OSGi framework is getting popular, many people need hibernate-core packaged as OSGi bundle. Although it is not hard for them to home-make a hibernate-core bundle, a bundle provided by hibernate team seems more portable and functional. Also, hibernate itself can use OSGi's features to enhance its functions.
> Rice

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list