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))' } 

ref# grails domain: mapping


Comments

Popular posts from this blog

javascript - ScrollTo Effect (href to div) -

javascript - ng-class not responding to change in model in Angular? -

javascript - document.registerElement extending HTMLInputElement prototype while using custom tag name to avoid implicit browser style -