-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Problems with time functions
PostPosted: Mon Aug 28, 2006 2:49 pm 
Newbie

Joined: Fri Aug 25, 2006 7:47 pm
Posts: 2
Location: Mexico City
[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"


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.