• Post Reply Bookmark Topic Watch Topic
  • New Topic

hibernate criteria does not return any values  RSS feed

Manon Baratt
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am trying to retrieve data using hibernate criteria in my Spring application. I had it working with a query in the hbm file but I need to use the hibernate criteria. I am passing one of the values for the Family class (Lastname = "Jones").
Here is part of my service code:

SessionFactory sessionFactory = new Configuration().configure()

Session session = sessionFactory.openSession();
Criteria criteria = session.createCriteria(Family.class);
families = (List<Family>) criteria.list();

I check the session and it is created. I also set the property below
<property name="hibernate.show_sql">true</property>

in hibernate.cfg.xml and set log4j to debug for hibernate. Trouble is that I do not see the query in my console and I don't see any results.

Please let me know if there some setup I am missing or any suggestion for debuggin this.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!