Search code examples
osgijbossfuseblueprint-osgi

OSGi Hibernate envers Support


I'm stuck in osgi envers support integrating in my bundle. I'm using hibernate-core and hibernate envers 4.2.22 redhat version, how to implement this in blueprint?

I have entities with @Audited annotations and importing org.hibernate.envers packages.

I want to use auditing and revisions.


Solution

  • After registered envers extension service, imported needed envers supported packages in my manifest. The required packages should be imported via Embed dependency method. Used Include-Resource tag for including hibernate resource and make sure add Bundle-Classpath for defining envers dependency. Now it is working fine in JBoss fuse karaf based OSGi container then revinfo and _aud tables got created successfully.

    Here is my Manifest,

    Manifest-Version: 1.0
    Bnd-LastModified: 1481971039345
    Build-Jdk: 1.8.0_112
    Built-By: Smile
    Bundle-Activator: com.fuse.hibernate.services.OsgiBundleActiva
     tor
    Bundle-Blueprint: OSGI-INF/blueprint/blueprint.xml
    Bundle-ClassPath: .,hibernate-envers-4.2.22.Final-redhat-1.jar
    Bundle-ManifestVersion: 2
    Bundle-Name: FUSE-HIBERNATE
    Bundle-SymbolicName: fuse-hibernate
    Bundle-Version: 1.0.0.SNAPSHOT
    Created-By: Apache Maven Bundle Plugin
    Export-Package: <Exported Packages>
    Export-Service: com.fuse.repository.CustomRepository
    Import-Package: org.hibernate.annotations;version="[4.2,5)",org.hibernat
     e.annotations.common.reflection;version="[4.0,5)",javax.persistence;ver
     sion="[2.0,3)",org.hibernate.proxy;version="[4.2,5)",javassist.util.pro
     xy;version="[3.18,4)",org.slf4j;version="[1.7,2)",javax.management,java
     x.naming,javax.persistence.metamodel;version="[2.0,3)",javax.transactio
     n;version="[1.1,2)",org.apache.commons.beanutils;version="[1.8,2)",org.
     apache.commons.lang3;version="[3.0,4)",org.apache.tools.ant,org.dom4j,o
     rg.dom4j.io,org.dom4j.tree,org.hibernate;version="[4.2,5)",org.hibernat
     e.action.spi;version="[4.2,5)",org.hibernate.cache;version="[4.2,5)",or
     g.hibernate.cfg;version="[4.2,5)",org.hibernate.collection.spi;version=
     "[4.2,5)",org.hibernate.criterion;version="[4.2,5)",org.hibernate.diale
     ct;version="[4.2,5)",org.hibernate.engine.jdbc.spi;version="[4.2,5)",or
     g.hibernate.engine.loading.internal,org.hibernate.engine.spi;version="[
     4.2,5)",org.hibernate.engine.transaction.spi;version="[4.2,5)",org.hibe
     rnate.event.service.spi;version="[4.2,5)",org.hibernate.event.spi;versi
     on="[4.2,5)",org.hibernate.id;version="[4.2,5)",org.hibernate.id.enhanc
     ed;version="[4.2,5)",org.hibernate.integrator.spi;version="[4.2,5)",org
     .hibernate.internal,org.hibernate.internal.util;version="[4.2,5)",org.h
     ibernate.internal.util.collections,org.hibernate.internal.util.config,o
     rg.hibernate.internal.util.xml,org.hibernate.jdbc;version="[4.2,5)",org
     .hibernate.mapping;version="[4.2,5)",org.hibernate.metamodel.source;ver
     sion="[4.2,5)",org.hibernate.metamodel.spi;version="[4.2,5)",org.hibern
     ate.persister.collection;version="[4.2,5)",org.hibernate.persister.enti
     ty;version="[4.2,5)",org.hibernate.property;version="[4.2,5)",org.hiber
     nate.service;version="[4.2,5)",org.hibernate.service.classloading.spi;v
     ersion="[4.2,5)",org.hibernate.service.jdbc.dialect.internal,org.hibern
     ate.service.jndi;version="[4.2,5)",org.hibernate.service.spi;version="[
     4.2,5)",org.hibernate.sql;version="[4.2,5)",org.hibernate.tool.hbm2ddl;
     version="[4.2,5)",org.hibernate.type;version="[4.2,5)",org.hibernate.us
     ertype;version="[4.2,5)",org.jboss.logging;version="[3.1,4)",org.joda.t
     ime;version="[2.9,3)",org.osgi.framework;version="[1.6,2)",org.osgi.ser
     vice.blueprint;version="[1.0.0,2.0.0)",org.w3c.dom,javax.sql
    Meta-Persistence: META-INF/persistence.xml