This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate query returning 0 records Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate query returning 0 records" Watch "Hibernate query returning 0 records" New topic
Author

Hibernate query returning 0 records

Gene Golovchinsky
Greenhorn

Joined: May 06, 2009
Posts: 6
I have an application that uses hibernate to get data from a MySQL database. I've enabled hibernate logging, and can see the query that is being generated. When I copy that query into the MySQL Query Browser and plug in the same values as are passed to my code, I get a bunch of records (867); when the code runs, however, it returns 0 records. The same code works with other data values. Any idea how to debug this?

Thanks,

Gene
Gene Golovchinsky
Greenhorn

Joined: May 06, 2009
Posts: 6
Looks like the problem was that I wasn't querying with the data that the system was actually using because of a logic flaw. Glad I caught it now!

Gene
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Hibernate query returning 0 records
 
Similar Threads
PreparedStatement's executeQuery() returning resultset with no rows
hibernate_struts_tomcat
Hibernate Query
Getting All Records in Hibernate
Problem with hibernate