I just want to retrieve list of data but by using below code why i get class cast exception...
public List<TbDiscussionForumAnswere> findTbDiscussionForumAnswerebyforumQuestionId(Integer forumQuestionId) {
session = sessionFactory.getCurrentSession();
TbDiscussionForumAnswere TbDiscussionForumAnswere = (TbDiscussionForumAnswere)session.createCriteria(TbDiscussionForumAnswere.class) .add(Restrictions.eq("forumQuestionId.forumQuestionId", forumQuestionId));
return (List<TbDiscussionForumAnswere>) TbDiscussionForumAnswere.getTbDiscussionForumAnswereCollection();
}
above method gives me below exception
java.lang.ClassCastException: org.hibernate.internal.CriteriaImpl cannot be cast to com.medikm.entity.TbDiscussionForumAnswere
Thank u