I'm always looking for ways to eliminate redundant code from my project.
I am using Hibernate with Spring. I have configured Spring's JPA LocalContainerEntityManagerFactoryBean, which lets me pass a bunch of properties to the JPA provider (Hibernate), which means I don't need to set those properties in the persistence.xml file.
Furthermore, Hibernate can find my persistent classes without my having to actually identify them in persistence.xml, so those <class> lines go away too.
I'm left with one line in my persistence.xml:
<persistence-unit name="bigDatabase" transaction-type="RESOURCE_LOCAL"/>
Does anyone know a way to eliminate persistence.xml completely and move the persistence unit definition into the Spring configuration file? I tried Googling of course but couldn't find an answer.
Thanks!
EntityManagerwith Hibernate's nativeSessionFactory.... less config that way - skaffman