Hibernate version:
3.1.3
We have a MediaObject class and want to search using time associated with the instances. However, the search retrives no result (while there is legal data in the db). The MediaObject class works fine anywhere else, so we assume it's not its problem.
No exception is thrown. When we copied the sql statement into the mysql query browser and execute it with real time params, we actually got results. We didn't try it with direct JDBC prepared statements, but we suspect it will work too. We ran into a similar problem before and managed to got *around* (instead of over) that one, and the JDBC prepared statement worked fine there while hibernate failed to retrive any results.
The HQL query string:
select searched.id from MediaObject searched where searched.time between ? and ?
Then bind params using:
setDate(0, new Date(0)); setDate(1, new Date());
The database we use:
MySQL 5.0.something
The generated SQL:
select mediaobjec0_.id as id6_ from medobjintr mediaobjec0_ where mediaobjec0_.time between ? and ? limit ?
|