Grails: Error while applying criteria Query -


i applying criteria query find sum of columns , save result in long format. when there data in table, working fine, in case no match records found, following error thrown:

cannot cast object 'null' class 'null' class 'long'**

my code is:

long referralpoints = referraldetail.createcriteria().get {     eq('referredby', user)     projections {         sum('referralpoints')     } } 

use long instead of long. primitives cannot null.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -