3 Replies Latest reply on May 12, 2011 2:27 AM by Sergey Zubarev

    Gatein and Envers

    Sergey Zubarev Newbie


      Is there any way to integrate jboss envers-1.2.3-hibernate3 (http://www.jboss.org/envers) in GateIn HibernateService?

        • 1. Gatein and Envers
          Sergey Zubarev Newbie

          To enable Envers I need to add 4 listeners to hibernate (post-insert, etc).

          But there is no hibernate.cfg.xml, and I not found any plugin for HibernateService to add listeners.


          Is there any way to add listener to hibernate configuration in HibernateService?

          • 2. Gatein and Envers
            Thomas Heute Master

            Only the identity component optionally use Hibernate, all portal configuration goes to the database through a JCR API without Hibernate.

            1 of 1 people found this helpful
            • 3. Re: Gatein and Envers
              Sergey Zubarev Newbie

              I solved my problem by creating custom hibernate service (see http://community.jboss.org/thread/166503?tstart=0), where I added listeners:



              public class CustomHibernateServiceImpl extends org.exoplatform.services.database.impl.HibernateServiceImpl 
                  public CustomHibernateServiceImpl(InitParams initParams, CacheService cacheService)
                      super(initParams, cacheService);        
                      getHibernateConfiguration().setListener("post-insert", "org.hibernate.envers.event.AuditEventListener");
                      getHibernateConfiguration().setListener("post-update", "org.hibernate.envers.event.AuditEventListener");
                      getHibernateConfiguration().setListener("post-delete", "org.hibernate.envers.event.AuditEventListener");
                      getHibernateConfiguration().setListener("pre-collection-update", "org.hibernate.envers.event.AuditEventListener");
                      getHibernateConfiguration().setListener("pre-collection-remove", "org.hibernate.envers.event.AuditEventListener");
                      getHibernateConfiguration().setListener("post-collection-recreate", "org.hibernate.envers.event.AuditEventListener");