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 - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -