Hi,
I just want to share my experience with gemini web in conjunction with spring/hibernate. I tried to configure hibernate using spring.orm and I had a lot of problems with it. First of all I start with an existing mapping layer with old style .hbm.xml mapping files (so no annotations).
Caused by: java.io.FileNotFoundException: OSGi resource[classpath:/root/domain/pkg/|bnd.id=46|bnd.sym=GeminiServerPlugin] cannot be resolved to absolute file path because it does not reside in the file system: bundleresource://46.fwk24463001/root/domain/pkg/
at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:242)
at org.springframework.osgi.io.OsgiBundleResource.getFile(OsgiBundleResource.java:342)
I did some debugging. This fails because ResourceUtils.getFile() expects a file scheme in the provided url. But the way the directory location is resolved, there is no such scheme defined in the url.
Second try. My mapping files reside next to my java domain models. Therefore I tried to just add all *.hbm.xml file which are located in my classpath:
This may work if the bundle is completely build and wrapped in a jar. In my case I am trying to run this from within eclipse. What happens is that each mapping file is found twice. Once in the bin\ and once in the src\ folder which - for some reason - is in the search classpath which is used to add the files.
The only working solution that I found is the following:
Thanks for the hint Mike. If I would go for a new project I would certainly give Gemini JPA a try. But my goal is to port an existing project to OSGI. The domain model consists of a couple of hundret objects which are all mapped with hibernate (not to mention all the Criteria and HQL-queries). To my knowledge Gemini JPA only provides integration with EclipseLink.
Gemini JPA uses EclipseLink as the JPA provider, but the main point is that the application does not need to assume any provider; it just needs to use standard JPA. Sounds like you are stuck with a legacy app that was written using proprietary API, though, so I guess you just have to make things work as best you can.