Joined: Wed Jun 22, 2005 8:38 am Posts: 1 Location: Palestine
|
my code:
Mapping file contains two deferent classes for the same table
session.createCriteria(entity.getClass())
.add(Example.create(entity).ignoreCase().enableLike().excludeZeroes());
list = criteria.list();
the following exception raised:
java.lang.ClassCastException: com.asal.emap.entity.Patient
org.hibernate.criterion.Example.getEntityMode(Example.java:234)
org.hibernate.criterion.Example.toSqlString(Example.java:164)
org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:313)
org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:94)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:1236)
org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:299)
com.asal.fw.base.dataaccess.DataAccess.find(DataAccess.java:272)
com.asal.fw.base.wf.WorkFlow.find(WorkFlow.java:135)
test.TestServlet.edit(TestServlet.java:279)
test.TestServlet.doGet(TestServlet.java:78)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
when i remove one of the two classes from map file, exception does not appear.
please help me.
_________________ Eng. Salah T. Hussein
Senior Developer
________________________________________
ASAL Technologies
Al-Balou', AL-Biereh, Palestine
Mobile: + 970-59-676 113
|
|