Quering computed fields in GORM

Posted by Tihom on Stack Overflow See other posts from Stack Overflow or by Tihom
Published on 2011-01-02T06:09:58Z Indexed on 2011/01/05 13:54 UTC
Read the original article Hit count: 175

Filed under:
|
|
|
|

I am trying to query the following HQL using GORM:

MailMessage.executeQuery("toId, count(toId) from (SELECT  toId, threadId FROM MailMessage as m WHERE receiveStatus = '$u' GROUP BY threadId, toId) as x group by x.toId")


The problem is that count(toId) is a computed field doesn't exist in MailMessage and that I am using a subquery.


I get the following error: java.lang.IllegalArgumentException: node to traverse cannot be null! Ideally, I would like to use a generic executeQuery which will return data of anytype. Is there such a thing?

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about grails