I am to fix an older project, in which there is a database query gone wrong. In the Table, there is a field
viewTime TIME NOT NULL DEFAULT 0
I need to filter out the rows that actually have 0 as their viewTime
:
Criteria query = /* create criteria */;
query.add(Restrictions.gt("viewTime", 0));
However, since viewTime
is defined as a Date:
@Temporal(TemporalType.TIME)
private Date viewTime;
I get a casting exception. On the other hand, I have no idea how to create a valid Date object that represents time 0
. I can't change the type of the field as well for this.
Any way I can express viewTime > 0
in this Criteria
object?