grails Issue in criteria

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

grails Issue in criteria

Smurfs
Hi,
if i use the below criteria it works, but, if i remove the commented line below "criteria.add(Restrictions.eq("val", Long.valueOf("50")))", then it throws the below exception:
call to [list] not supported here.
Can anyone please let me know, why this issue happens



               def criteria = Test.createCriteria()
                //criteria.add(Restrictions.eq("val", Long.valueOf("50")))
               
                def testList = criteria.list(){
                        projections{
                                sum("count" ,"count")
                                groupProperty("div" ,"div")
                                }
                        resultTransformer Criteria.ALIAS_TO_ENTITY_MAP
                }

Reply | Threaded
Open this post in threaded view
|

Re: grails Issue in criteria

Smurfs
Even i tried below:

def c = Domain.createCriteria()

def temp = {
eq('name', 'peter')
}
c.list(temp)

It did not work. Can anyone please help.