我有两个表Doctor
,shift
通过 Hibernate 查询语言,我在单个查询中从表中选择两个fields
,从Doctor
表中选择两个字段,Shift
所以我面临显示该数据的问题。我为此写了一个bean
类,喜欢DoctorShift
将列表转换为List<DoctorShift>
我得到的java.lang.ClassCastException
结果,所以该做什么给出相同的想法.....
code is like this
Query qry="-----";//valid query
List<DoctorShift> list=(List<DoctorShift>)qry.list();
System.out.println(" Size of list is "+list.size());// i'm getting 2
DoctorShift ds=list.get(0);// here i'm getting Exception
qry="select s.shiftNameId,s.shiftName,d.doctorRegnumvar,"
+"d.doctorFnamevar,d.doctorLnamevar,d.doctorstatus,"
+"sm.shiftstatus,s.shiftTime from ShiftDaoBean s,"
+ "DoctorDaoBean d,DoctorShiftMappingBean sm where "
+"d.doctorid=sm.doctoridfk and s.shiftID=sm.shiftidfk"
+" and d.doctorid=:doctorID ";
帮我...
提前致谢