The situation is this. I had a working application which used Hibernate annotated classes, and JTA for data bindings, within a spring framework. Then I moved the annotated classes into a Jar file, and the application stopped working. Hibernate knew nothing about the classes because the PersistenceAnnotationBeanPostProcessor does not traverse into the JARS on the classpath. Further neither the entity manager or HibernateJpaVendorAdapter have options to specify the explicit paths to the classes.

So, after heaps of trials and tests I’ve had to abandon the JPA approach and use the direct Spring-Hibernate bindings, as they allow you to specify the path to a mappings file. This is a pain, as all my code is written to use an entityManager and now I have to have duplicate implementation which use the hibernate session factory. Perhaps there is a hibernate implementation of the entity manager, but I could not find it.

I used this blog entry for most of the config code.

Powered by ScribeFire.