grails - How to Map Reference to Object with Composite Key ID -


suppose have following:

class objecta implements serializable {     foo foo     string objecttype      static mapping = {         version false         id composite: ['foo', 'objecttype']         foo column: 'foo'         objecttype column: 'objecttype'     } } 

now, need reference object domain.

class objectb {     objecta objecta      columns {        objecta{           column name: 'foo'           column name: 'objecttype'        }     } } 

when try , load objectb, following:

cannot treat multi-column property single-column property 

how should mapping this?

what attempting columns section, ask because have unfamiliar concept? this stack overflow link may help.

but, show in link, if want reference object should create relationship (the 1 in example unidirectional) between 2 domains.

class object b {      static hasone[objecta:objecta]     .... } 

there isn't more that. can access fields objecta within views using objectbinstance.objecta.channelname.


Comments