I'm using Hibernate 3.2 CR2 and Hibernate Annotations 3.2 CR1. My hibernate.cfg.xml looks like:
Code:
<hibernate-configuration>
<session-factory>
<mapping class="com.mypackage.MyClass"/>
<mapping resource="com/mypackage/OtherClassHbm.xml"/>
</session-factory>
</hibernate-configuration>
And I get the following exception:
Code:
java.lang.IllegalAccessError: tried to access field org.hibernate.cfg.Configuration.xmlHelper from class org.hibernate.cfg.AnnotationConfiguration
at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:556)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:425)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1325)
When I drop the mapped resource, i.e. just use a mapped class, there is no problem. This seems like a case of the Hibernate Annotations and Hibernate core code being out of syn. I know that I can't use Hibernate 3.2 CR3 with Hibernate Annotations because I'll get a java.lang.NoClassDefFoundError: org/hibernate/loader/custom/SQLQueryReturn ( see
http://forums.java.net/jive/thread.jspa?messageID=133554&tstart=0 )
I tried Hibernate 3.2 CR1 just for kicks, and it was a no-go as well. Any ideas? Do I need to build both Hibernate3 and HibernateExt from source, or is mixing annotated classes and mapping files just not supported.
Note: The two classes in the sample hibernate.cfg.xml do not reference each other.