-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Need help with configuring of audit
PostPosted: Mon Nov 24, 2014 8:58 am 
Newbie

Joined: Fri Oct 03, 2014 7:46 am
Posts: 3
Hello
I want to have audited tables
I've put annotations and now I want to customize the names of audited tables, so I want to change default prefix and suffix.
in previous project I've used JPA realization and I've done this changes inside persistece XML and it's was in ths way:
Code:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
   version="1.0">
   <persistence-unit name="projectLocalPU"
      transaction-type="RESOURCE_LOCAL">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <properties>
         <!-- other hibernate properties -->

         <property name="hibernate.ejb.event.post-insert"
            value="org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener" />
         <property name="hibernate.ejb.event.post-update"
            value="org.hibernate.ejb.event.EJB3PostUpdateEventListener,org.hibernate.envers.event.AuditEventListener" />
         <property name="hibernate.ejb.event.post-delete"
            value="org.hibernate.ejb.event.EJB3PostDeleteEventListener,org.hibernate.envers.event.AuditEventListener" />
         <property name="hibernate.ejb.event.pre-collection-update"
            value="org.hibernate.envers.event.AuditEventListener" />
         <property name="hibernate.ejb.event.pre-collection-remove"
            value="org.hibernate.envers.event.AuditEventListener" />
         <property name="hibernate.ejb.event.post-collection-recreate"
            value="org.hibernate.envers.event.AuditEventListener" />
            
         <property name="org.hibernate.envers.revision_on_collection_change"
            value="false"/>
         <property name="org.hibernate.envers.audit_table_suffix" value=""/>
         <property name="org.hibernate.envers.audit_table_prefix" value="AUD_"/>
      </properties>
   </persistence-unit>

</persistence>


but now I'm using Hibernate and my configuration don't have persistence XML
config example:
Code:
<bean id="localSessionFactory"
      class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
      <property name="packagesToScan">
         <list>
            ...
         </list>
      </property>
      <property name="multiTenantConnectionProvider" ref="multiTenancyConnectionProvider" />
      <property name="currentTenantIdentifierResolver">
         <bean class="path to my TenantIdentifierResolver" />
      </property>
      
      <property name="hibernateProperties">
         <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.multiTenancy">SCHEMA</prop>
            
         </props>
      </property>
   </bean>


I've found the way how to put listeners in this configuration, but how to change here suffix and prefix I can't find.
when I try to put:
Code:
<property name="org.hibernate.envers.audit_table_suffix" value=""/>
         <property name="org.hibernate.envers.audit_table_prefix" value="AUD_"/>

it tell me that org.springframework.orm.hibernate4.LocalSessionFactoryBean don't have such setter
maybe somebody tried to work in this way and know the correct way how to change this properties inside XML configuration?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.