I have a maven project that uses spring, hibernate (3.6.4), GWT(2.3), drools,.... Everything used to work fine till I began using hibernate OneToMany, ManyToMany relations..
We had the exact same problem and outputting OneToMany.class.getProtectionDomain().getCodeSource().getLocation() showed us the problem. We were picking up ejb3 JAR due to a stale dependency in our pom. Thank you very much for posting this solution!
By the way, remember to run mvn eclipse:eclipse if you're using Eclipse, else the .classpath will still refer to the unwanted JAR.
i had the same problem, i soved it by removing the persistence-api-1.0.2.jar from the classpath
Thanks....This helped me with the same problem. When running as a web app I got the "Bad" path but when running as an application I got the "Good" path.
Bad /C:/Program Files (x86)/IBM/SDP/runtimes/base_v7/plugins/javax.j2ee.persistence.jar
Good /C:/hibernate-release-4.1.7.Final%20(1)/hibernate-release-4.1.7.Final/lib/required/hibernate-jpa-2.0-api-1.0.1.Final.jar
It causes with use of persistence-api annotations in entity classes, to resolve this problem let your classpath contains
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.4.0.GA</version>
<scope>provided</scope>
</dependency>
this dependency to use of ejb3-persistence.jar