I am having some problems getting AnnotationConfiguration to work. I have several entities that are annotated with javax.persistence. All of the entities are deployed and working in a jboss server. Due to time constraints, I need to access the database directly from a seperate webapp, so I am reusing the entity classes.
I configure like this:
AnnotationConfiguration annotationConfiguration = new AnnotationConfiguration();
annotationConfiguration.addAnnotatedClass(Account.class);
// set connection properties and dialect, all with .setProperty
return annotationConfiguration.buildSessionFactory();
I have tried using Hibernate 3.2.0.rc1, 3.2.0.ga, 3.2.1.ga and 3.2.2.ga with annotations 3.2.0.ga, 3.2.1.ga and 3.3.0.ga. Except from 3.3.0.ga which I downloaded from hibernate.org, I have downloaded through maven each time. I havent tried every possible combination of the above versions, but a few off them I have tried, including 3.2.2.ga with annotations 3.2.1.ga and 3.3.0.ga.
When I start up, I always get the error: java.lang.NoSuchMethodError: org.hibernate.cfg.SecondPass.doSecondPass(Ljava/util/Map;)V
When I debug into the code here, and runtime get the methods from the object which the no such method exception is thrown on, and from SecondPass, I get the following info:
[public org.hibernate.mapping.ToOne org.hibernate.cfg.FkSecondPass.getValue()
public void org.hibernate.cfg.FkSecondPass.doSecondPass(java.util.Map) throws org.hibernate.MappingException
public boolean org.hibernate.cfg.FkSecondPass.isInPrimaryKey()]
----
[public abstract void org.hibernate.cfg.SecondPass.doSecondPass(java.util.Map
java.util.Map) throws org.hibernate.MappingException]
Does SecondPass take 2 Maps? Doesn't look like it when I examine the source that maven downloaded along with hibernate 3.2.1.ga. Also, javadoc says only 1 map argument:
http://www.hibernate.org/hib_docs/v3/api/
Which version of annotations work with which versions of the API? I would prefer to use hibernate-annotations 3.2.1.ga or earlier, as 3.3.0.ga is not in the central maven repository.