gorm - grails derived property creating column in database -
i'm using grails 2.4.4.
i have domain
class post { integer nbroffavorites static hasmany = [ favorites : favorite ] static mappings = { nbroffavorites formula: '(select count(1) favorite f (f.post_id = id))' } }
the problem nbroffavorites being created in database, retrieving doesn't take account formula.
is there wrong in syntax ?
thanks
yes there typo in syntax. change mappings
mapping
, like:
static mapping = { nbroffavorites formula: '(select count(1) favorite f (f.post_id = id))' }
Comments
Post a Comment