Hi Folks,
I'm new on the topic Hibernate and I have got a problem.
I've got a criteria on by database and i want to get a String with the help of uniqueResult. But I always get a ClassCastException and I do not know how to solve my Problem. Here my Code:
Code:
public static String getMitarbeiterId(String projektId, String projekt) {
Session session = HibernateUtil.getCurrentSession();
Criteria c = session.createCriteria(ProjektPlaner.class);
c.add(Restrictions.eq("id", projektId));
c.add(Restrictions.eq("projekt", projekt));
c.add(Restrictions.eq("planer", Boolean.TRUE));
c.setMaxResults(1);
return (String) c.uniqueResult();
}
Thanks for help.
heidi