11
Since Spring 3.1, you also have the option to forget persistence.xml altogether, and configure your EntityManagerFactory using the packagesToScan property, similar to this:
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
p:dataSource-ref="dataSource"
p:packagesToScan="${jpa.entity.packages}">
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
p:showSql="${hibernate.show_sql}"/>
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
</props>
</property>
</bean>
See Pascal Thivent answer here : Do I need <class> elements in persistence.xml?
you have different way to do it, but JPA itself does not support auto-scan. The simplest and cleanest way to reference your entities IMHO is to package your model in a jar and to reference it with <jar-file>MyModel.jar</jar-file>