This content has been marked as final. Show 2 replies
String query="select MD.ramSize,MD.cpuTemp,MD.cpuType FROM MachineData MD where MD.srNo="id;
List<MachineData> macDataList= (List<MachineData>)sess.createQuery(query).list();
Your query might have caused this issue. List<Object> returned from the query instead of List<MachineData>.
Change the query to return MachineData object and try,
String query=" from MachineData as MD where MD.srNo="+id;
Because you are trying to cast an Object to your class, which can't be done.
Evidently 'sess.createQuery().list()' returns an Object.
Next time please use the CODE button when posting code.