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?