I am new to JPA & hibernate, when I try this tutorial . I added the following provider in my persistence.xml,
org.hibernate.ejb.HibernatePer
Use the following dependencies...
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.4.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.5-Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.0.4.Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
Check your version of Hibernate, you need hibernate-core 3.6.0 or higher to use the method addAnnotatedClass
of org.hibernate.cfg.Configuration
In addition:
I've faced the same problem and I came to this page after googling for an answer and none of these answers helped me, so in case that somebody passes through the same problem:
I had an ArrayList<Entity>
and when I wanted to add an item to the arraylist, the NoSuchMethodException encountered. The problem was that the ArrayList
had to be an Array
.
It look like the Hibernate Annotation jar is wrong. It is not compatible with the jar version. So that is why it showing the "java.lang.NoSuchMethodError"
Could you please tell me the which jar version are you currently working , please specify the version ? Then only we have to easily address this.
Which Hibernate version are you currently working ?
Which Annotation version are you currently working ?
please specify the version. Thanks.