[hibernate-dev] OSGI manifests for hibernate-orm

Steve Ebersole steve at hibernate.org
Wed Aug 15 18:42:09 EDT 2012


Martin,

Totally agree about the org.hibernate.engine.spi bits.  Thats always 
been fugly hack.  Both org.hibernate.engine.spi.CascadeStyle and 
org.hibernate.engine.spi.CascadingAction attempt to combine contracts 
and enumerations, which I have never been a fan of here. I think its 
fine when that contract is simple.  But these contracts have a few 
methods, some of whose implementations are not trivial. I think 
splitting those immediately makes even the approach you suggest easier.

In fact splitting those purposes alone solves the problem with 
org.hibernate.engine.spi.JpaCascadingAction I believe

As for org.hibernate.engine.spi.JpaCascadeStyle, TBH, I am not sure 
exactly why we need this split between persist() handling for 
hibernate-core versus persist() handling for hibernate-entitymanager. I 
asked Hardy about this a few weeks ago when I was working on integrating 
JPA 2.1 on master.  But I forget the reasoning.  Hardy?  I just remember 
that the end result was we decided it was best to leave them separate.  
Even leaving them split, I would think we could do something like having 
the org.hibernate.jpa.internal.event.JpaIntegrator register the 
override, rather than doing it in static loading blocks.

As for tools/envers stuff, not really any clue.  Max?  Adam? Lukasz?  I 
do know that I never really liked this cyclic dep.

Not being well-versed in OSGi, could you explain what 'blueprint.xml' 
is?  I guess the purpose is the same/similar to 
/META-INF/services/javax.persistence.spi.PersistenceProvider defined by 
JPA, yet OSGi specific?

I'd much rather see this in 5.0 which is slated as the next release atm, 
or 4.2 if we end up needing a JPA 2.1 specific release.


P.S. I am using the class names from master above which sometimes 
deviate from those on 4.1...


On 08/15/2012 05:08 PM, mailing at bibbernet.org wrote:
> Hello,
>
> because I need clean OSGI bundles for Hibernate and especially Envers, 
> I am working on some patches for the 4.1 branch of hibernate-orm to 
> enable generation of OSGI compatible jar files.
>
> During the work I have found the following problems, and need some 
> help and/or feedback. The problems are:
>
> - The package org.hibernate.engine.spi is exported by two jar files, 
> hibernate-core and hibernate-entitymanager, which is not possible in 
> OSGI. The Problem is the STYLES map in CascadeStyle in hibernate-core  
> which prevent that the package in hibernate-entitymanager can be 
> refactored from org.hibernate.engine.spi to 
> org.hibernate.ejb.engine.spi, to solve the duplicate export.
> I think to fix this problem, the following steps should be done:
> - Add a setter method to CascadeStyle to allow subclasses to add 
> CascadeStyles to the map STYLES
> - Refactor the package org.hibernate.engine.spi in hibernate-envers to 
> org.hibernate.ejb.engine.spi
> - Use the setter method to add the new CascadeStyle in EJB3CascadeStyle
>
> - The package org.hibernate.tool.ant is exported by to jars, 
> hibernate-tools (version: 3.2.0.ga) and hibernate-envers, which is 
> also a duplicate export problem. The problem is that HibernateToolTask 
> in hibernate-tools has no getters/setters for configurationTask and 
> thus hibernate-envers is directly reading/modyifing the property 
> configurationTask. I think to fix this problem, the following steps 
> should be done:
> - hibernate-tools should add public getters/setters for 
> configurationTask in class HibernateToolTask
> - the package org.hibernate.tool.ant in hibernate-envers should be 
> refactored to org.hibernate.envers.tool.ant
> - the property configurationTask should be accessed sole thru the 
> getters/setters .
>
> It would be nice if someone could check and comment my planned and 
> already done  changes.
>
> I have already done the CascadeStyle fix, the configurationTask fix is 
> outstanding because I need to know against which version of 
> hibernate-tools I should create the fix.
>
> In generally the following tasks are done until now:
> - added configuration to gradle scripts to generate the osgi manifests 
> for all jar files in hibernate-orm (needs maybe some cleanup) - right 
> now the build files for hibernate-core, hibernate-entitymanager and 
> hibernate-envers are modified.
> - added blueprint.xml to hibernate-entitymanager to announce the 
> availabillity of a javax.persistence.provider
>
> Next steps:
> - add osgi manifests to the other jars of hibernate-orm
> - write integration tests with pax exam and karaf 2.2.x
> - finish refactoring of hibernate-tools
> - add patches for other needed dependencies 
> (hibernate-commons-annotations and more)
> - more testing, more integration tests
>
> Help, reviews and comments are welcome, and if someone has already 
> done the work or parts, please drop me a note.
>
> Attached find a patch against the branch 4.1 of hibernate-orm.
>
> regards
> Martin Neimeier
>
>
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev


-- 
steve at hibernate.org
http://hibernate.org



More information about the hibernate-dev mailing list