Back Forum Reply New

Can't get AuditingEntityListener to fire

Hi,
I am playing around with Spring Data JPA and thought I would give the AuditingEntityListener a try. I have followed instructions from here sprin.../#jpa.auditing and created my implementation of AuditorAware interface but I can't seem to get the listener to fire. (note I have not implemented the Auditable anywhere yet but I simply wanted to get my AuditorAware implementation to be invoked).

My persistence.xml looks like:

Code:
lt;persistence-unit name=quot;spring-jpaquot; transaction-type=quot;RESOURCE_LOCALquot;gt;       lt;providergt;org.hibernate.ejb.HibernatePersistencelt;/providergt;       lt;mapping-filegt;META-INF/orm.xmllt;/mapping-filegt;       lt;propertiesgt;lt;property name=quot;hibernate.dialectquot; value=quot;org.hibernate.dialect.PostgreSQLDialectquot;/gt;lt;!-- value=quot;createquot; to build a new database on each run; value=quot;updatequot; to modify an existing database; value=quot;create-dropquot; means the same as quot;createquot; but also drops tables when Hibernate closes; value=quot;validatequot; makes no changes to the database --gt;lt;property name=quot;hibernate.hbm2ddl.autoquot; value=quot;validatequot;/gt;lt;property name=quot;hibernate.ejb.naming_strategyquot; value=quot;org.hibernate.cfg.ImprovedNamingStrategyquot;/gt;lt;property name=quot;hibernate.connection.charSetquot; value=quot;UTF-8quot;/gt;lt;!-- Uncomment the following two properties for JBoss only --gt;lt;!-- property name=quot;hibernate.validator.apply_to_ddlquot; value=quot;falsequot; /--gt;lt;!-- property name=quot;hibernate.validator.autoregister_listenersquot; value=quot;falsequot; / --gt;       lt;/propertiesgt;   lt;/persistence-unitgt;
My orm looks like:

Code:
lt;?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?gt;
lt;entity-mappings xmlns=quot;xml/ns/persistence/ormquot;
xmlns:xsi=quot;2001/XMLSchema-instancequot;
xsi:schemaLocation=quot;xml/ns/persistence/orm xml/ns/persistence/orm_2_0.xsdquot;    version=quot;2.0quot;gt;
lt;persistence-unit-metadatagt;   lt;persistence-unit-defaultsgt;   lt;entity-listenersgt;   lt;entity-listener class=quot;org..data.jpa.domain.support.AuditingEntityListenerquot; /gt;   lt;/entity-listenersgt;   lt;/persistence-unit-defaultsgt;   lt;/persistence-unit-metadatagt;
lt;/entity-mappingsgt;
and I have registered the following in application context.

Code:
lt;!--  Scan repositories for insert of Crud operations --gt;       lt;jpa:repositories base-package=quot;com.xxx.yyy.publisher.admin.dao.jpaquot; /gt;   lt;!-- Set up Auditing Bean --gt;   lt;jpa:auditing auditor-aware-ref=quot;auditorAwareBeanquot; /gt;

lt;bean id=quot;auditorAwareBeanquot; class=quot;com.xxx.yyy.publisher.admin.dao.jpa.LoggedInAwarequot; /gt;
But I can't get my LoggedInAware (implements AuditorAware) to be invoked.

Am I missing something? Any ideas more than welcome.

Cheers
Andreas
¥
Back Forum Reply New