mongodb - What does actually do static mapWith="mongo"? -


static mapwith = "mongo"

i not clear means. according http://grails.github.io/grails-doc/3.0.x/ref/domain%20classes/mapwith.html

mapwith

purpose

the mapwith static property adds ability control if domain class being persisted.

examples

class airport {   static mapwith = "none"  } 

i went through question remove simpledb mapwith meta programming in dev mode

and got idea in grails application,

static mapwith = "mongo"

might using mongodb plugin. still not clear. went through these stackoverflow links :

  1. get mapwith static domain field value grailsdomainclass grails

  2. is possible in grails disable persistence of domain class dynamically inheritance

  3. migration mongodb postgresql groovy application

in grails if want make fields non-persistent can use transient keyword this:

class domainclass { static transients = ['field1', 'field2'] integer field1 integer field2 integer persistentfield1 integer persistentfield2  } 

it possible make whole domain class non-persistent using mapwith keyword.

class nonpersistentdomain { ......... .................... ....................... static mapwith = 'none'; } 

one can argue better use command object instead of domain has own advantages:

it can accessed using grailsdomainclass. participates while generating ui through scaffolding.

also see link

grails data mapping mongo manual!


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -