Wednesday, 17 February 2016

How to resolve the error "java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: TravelEntity is not mapped" in hibernate

If you encounter any such error

java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: TravelEntity is not mapped [ from TravelEntity]
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1374)
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)
org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:294)

Add an entry in persistence.xml of the particular entity class  as like below under the persistenceunit tag
<class>com.data.TravelEntity</class>

Ex:
<persistence-unit name="travelPU" transaction-type="JTA">
<class>com.data.TravelEntity</class>

No comments:

Post a Comment