• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

org.hibernate.MappingException: Unknown entity

 
vicky Aggarwal
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am getting this error, when i am trying to retrieve value from database.
But i am getting this error only when i am using auto generated method.
public List<CUser> findByExample(CUser instance) {
List<CUser> results = (List<CUser>) sessionFactory
.getCurrentSession().createCriteria("CUser").add(
create(instance)).list();
}

I am facing no problem if i uses query ..
Query query = sessionFactory
.getCurrentSession()
.createQuery(
" from CUser u1 where u1.userId = 1");

Any idea ??
Please help me ..
 
vinora kumar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use like this


 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you use this class in typical queries, loads and gets? Make sure it's either added to your AnnotationConfiguration or in your configuration file.

-Cameron McKenzie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic