This content has been marked as final.
Show 3 replies
-
1. Gatein and Envers
zsv May 9, 2011 1:04 PM (in response to zsv)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
theute May 9, 2011 2:51 PM (in response to zsv)1 of 1 people found this helpfulOnly the identity component optionally use Hibernate, all portal configuration goes to the database through a JCR API without Hibernate.
-
3. Re: Gatein and Envers
zsv May 12, 2011 2:27 AM (in response to zsv)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"); } }