-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Example of criteria bug
PostPosted: Wed Jun 22, 2005 9:13 am 
Newbie

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.