hi everyone
I am trting to load an object from my database table MyUserType:
Code:
Session session = HibernateUtil.openSession();
MyUserType type=(MyUserType) session.get(MyUserType.class,"1");
but I got this execption:
Code:
org.hibernate.MappingException: Unknown entity: com.ext.portlet.login.model.MyUserType
so I tried with sql query:
Code:
Session session = HibernateUtil.openSession();
MyUserType type=(MyUserType) session.createSQLQuery("select * from MyUserType where myusertypeid=1;").uniqueResult();
and I got this exception:
Code:
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.ext.portlet.login.model.MyUserType
I also tried with hql query
Code:
Session session = HibernateUtil.openSession();
MyUserType type=(MyUserType) session.createQuery("from MyUserType where myusertypeid=1").uniqueResult();
and I've got this new exception:
Code:
org.hibernate.exception.SQLGrammarException: could not execute query
thanks in advance