Results 1 to 2 of 2

Thread: Hibernate and OSGi integration

  1. #1
    Join Date
    Apr 2011
    Posts
    1

    Default Hibernate and OSGi integration

    Hi,
    I know that there are many post related to this theme, but I couldn't find any simple example
    I'm creating spring dynamic bundle which should communicate with database and I decided to use Hibernate as I used it in non OSGI application.
    Maybe somebody knows good example how to do that?

    At the moment I'm getting error org.hibernate.cfg.Configuration class not found. When I use it in import package the bundle even not compile in eclipse.

    Thank you in advance

    J. Lu

  2. #2
    Join Date
    Apr 2011
    Posts
    3

    Default

    If you have placed your hibernate.jar (+ its dependent jars) within your DM bundle's lib directory, it needs to be part of the DM bundle project's 'build path', and 'runtime class path' You cannot import hibernate pkgs through the DM bundle's MANIFEST.MF if your hibernate jars are not OSGi bundles.

    To use hibernate in a fully OSGi-ified environment, you would need to repackage hibernate and all its dependencies as OSGi bundles themselves, and make sure they import / export all the right pkgs within their own manifests. This is a non-trivial task: for example, a circular dependency between hibernate and antlr will trip you up. If you use JPA, load-time-weaving issues will take time to sort out.

    If I were just starting out with OSGi and Spring DM, I would not try to OSGi-ify hibernate yet. Put the original hibernate jars in the DM project's lib dir, and make sure those jars are on the project's build path and runtime classpath.

    Good luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •