Took me a few hours to get to the bottom of this.
I was getting the following Exception, which did not make sense as the deSerialization test passed OK.
I have a domain object that I had proved through a unit test that I could serialize & deserialize successfully.
My domain object contained the following object which if I removed then worked OK:
But tomcat & my integration test were both failing with the following Exception.
It turns out I had missed out an annotation, obvious really but I could not spot the error & the Exception was totally misleading. What had I missed? The '@manyToOne' annotation. Twit.
Showing posts with label hibernate3. Show all posts
Showing posts with label hibernate3. Show all posts
Thursday, 2 October 2014
Saturday, 5 April 2008
hibernate3 - hibernateQueryException - Class is not mapped
I have been having a problem for a while trying to get a basic hibernate3 and Spring 2.5 example working. Using old style hibernate CLASS_NAME.hbm.xml files worked fine. When I changed the context.xml file to try & use annotations instead I got the following error:
Check the imports of your '@Entity' annotations in your beans
If it is:
Exception in thread "main" org.springframework.orm.hibernate3.HibernateQueryException:
Test is not mapped [from Test t where t.name = ?];
nested exception is org.hibernate.hql.ast.QuerySyntaxException:
Test is not mapped [from Test t where t.name = ?] at
org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:640)
Check the imports of your '@Entity' annotations in your beans
If it is:
org.hibernate.annotations.Entity;Then change it to:
import javax.persistence.Entity;and life will be sweet.
Subscribe to:
Posts (Atom)