Hi,
I've been putting together a schema with indexes and such and the following query
Code:
select * from stringfixmessagetick where seqNum >= 10591263 having timestamp > Timestamp('2010-03-04') and channelid = 111 limit 10000
is something I've been using in a MySQL query app. For detail, I'm using where with a separate having because this way MySQL uses the index I have created on "seqNum" instead of my index on "(channelId, timestamp)."
Now when I execute the following HQL statement:
Code:
Query query = session
.createQuery("from StringFixMessageTick "
+ "where seqNum >= "
+ seqNum
+ " having channelId = " + channelId
+ " and timestamp >= " + date);
I get this error
Code:
org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: having near line 1, column 82 [from com.icarus.common.fix.messages.ticks.StringFixMessageTick where seqNum >= 4 having channelId = 111 and timestamp >= 3];
Is there a particular reason HQL doesn't support this?
If I can't do this query without a group by, what would be the simplest (non result modifying) group by I could add? I tried "group by id" but that didn't seem to work...
Thanks in advance for any help.