Hello there,
I have a named query :
@javax.persistence.NamedQuery(
name="query.TaskDAO.loadTaskByDate",
query="from Task t where t.deadlineDate between :beforeDate and :afterDate"
)
and a POJO
@Entity
public class Task extends DescriptibleObject implements Serializable {
(...)
@Temporal(TemporalType.TIMESTAMP)
private Date deadlineDate;
(...)
When I run the named query to fetch some "Task" objects with 'deadlineDate' between two given date, I got an empty result set, even with data that fits in the DB
In the logs, I have ( hibernate log in DEBUG level)
2006-08-01 11:50:17,546 DEBUG org.hibernate.loader.hql.QueryLoader - bindNamedParameters() Wed Jul 19 00:00:00 CEST 2006 -> beforeDate [1]
2006-08-01 11:50:17,546 DEBUG org.hibernate.type.DateType - binding '19 juillet 2006' to parameter: 1
2006-08-01 11:50:17,546 DEBUG org.hibernate.loader.hql.QueryLoader - bindNamedParameters() Wed Jul 19 23:59:59 CEST 2006 -> afterDate [2]
2006-08-01 11:50:17,546 DEBUG org.hibernate.type.DateType - binding '19 juillet 2006' to parameter: 2
2006-08-01 11:50:17,546 DEBUG org.hibernate.jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0)
2006-08-01 11:50:17,546 DEBUG org.hibernate.loader.Loader - processing result set
2006-08-01 11:50:17,546 DEBUG org.hibernate.loader.Loader - done processing result set (0 rows)
Everything is correct (parameter binding, aso), and after some testing, I suspect the precision of the date to be the cause of my problem.
But since I annotated the precision with the @Temporal annotation, I don't know where to seek elsewhere to fix my problem...
Any help would be greatly appreciated !
Thanks in advance,
sne.
|