I am currently using criteria to retrieve the details of a user, but when trying to query the details object with the right user, I get a ClassCastException.
My Criteria Code;
Criteria criteria = sess.createCriteria(UserDetails.class)
criteria.add(Restrictions.eq("user.id", user.id));
I also tried using;
Criteria criteria = sess.createCriteria(UserDetails.class)
Criteria subCriteria = criteria.createCriteria("user");
subCriteria.add(Restrictions.eq("id", user.id));
Both give me the ClassCastException. I know I can easily solve it by letting the User implement Serializable, but is there any other solution?
You should implement Serializable
interface.