This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate criteria does not return any values

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

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()
.buildSessionFactory();

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.

Thanks!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic