Announcement Announcement Module
No announcement yet.
Configuring EntityListener without Persistence.xml Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configuring EntityListener without Persistence.xml

    I've started the migration of my repository from Spring3.0 -> Spring3.1 and one of the areas which is causing some problem is the migration to the new way of handling entityManagers. Right now I am configuring it using a simple standard approach:

    	<bean id="entityManagerFactory"
            <property name="packagesToScan" value="" />
            <property name="dataSource" ref="dataSource" />
    		<property name="jpaVendorAdapter">
    			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    				<property name="generateDdl" value="${db.generateDdl}"/>
    				<property name="databasePlatform" value="${db.dialect}" />
    				<property name="showSql" value="${db.showSql}" />
    		<property name="jpaPropertyMap">
    				<entry key="namingStrategy" value=""/>
    This allows me to configure the Entities without specifying the persistence.xml file. However it is unclear how the orm.xml file is to be treated in this new environment as there are entity listeners configured within it:

    <?xml version="1.0" encoding="UTF-8"?>
    <entity-mappings xmlns="" xmlns:xsi="" xsi:schemaLocation="" version="2.0">
                    <entity-listener class="" />
    Without the persistence.xml how does one tell spring that it needs to configure an entity listener on all of the spring beans so that they will support auditing?

  • #2
    I am also looking for this solution for ages now. How did it go? Did you solve it?

    Could you please submit a solution if you solved it?


    • #3
      With spring 3.1 a new mappingResource property has been added. That property allow to specify the path of the orm.xml file. (see

      Unfortunately I'm not sure this really work because I cannot get the AuditingEntityListener to work in my project (see