Hi;
I have read through Hibernate/JPA/Maven documentation and several online forums but it is absolutely unclear how to setup Maven 2 to work with JPA for Hibernate. I haven't been able to get it to work. I have tried setting numerous dependencies (Hibernate, JPA, javax.persistence, etc.) but any combination I try does not seem to work. Maven is extremely frustrating...
I have created a Maven quickstart project I have created a simple unit test in src/test/java that tests getting an EntityManager I have created a persistence.xml file in src/main/resources and/or src/test/resources and configured it for MySQL I have created a pom.xml in the project root with dependencies (many failed attempts to guess which were required)
In Maven, I get a successful compilation, but the unit test fails saying that no persistence provider was found. I'm quite certain that Maven finds the persistence.xml file, as it moves it to the target/ folder.
When I setup a simple java app and run the unit test manually, it is successful. So I know my persistence.xml file is fine, I know my unit test class is fine, I correctly specify all the required libraries/jar files, the problem is with the Maven configuration.
I would greatly appreciate a simple explanation or a downloadable zip/jar showing the proper setting for Maven 2 to work with Hibernate and JPA. Which Hibernate dependencies do I need? Do I need a JPA or javax.persistence dependency? Do I need a transaction or other dependency? Do I need a MySQL dependency? Do I need some other dependency(ies) like javassist?
Thanks!
|