[b]Hibernate version: 3.1[/b]
The problem I'm facing is that my query doesn't work in Hibernate, i'm having trouble with the intervals, but if I type the same query in MySQL's console i get the results, has anyone faced something like this??
I'll apreciate ANY help
[b]Code between sessionFactory.openSession() and session.close():[/b]
[code]
String sql = "select count(*) from Table a WHERE (a.closedDate IS NULL
OR a.closedDate > current_date - interval 4 day) AND
a.enabled = 1 AND (a.postingDate IS NULL or a.postingDate <
current_date + interval "+days+" day ) AND STATUS in(3)";
Query query = session.createQuery(sql);
int result = (Integer)query.uniqueResult();
[/code]
[b]Name and version of the database you are using:[/b]
MySQL 5.0.18
_________________ "It is impossible to make anything foolproof because fools are so ingenious"
|