Monday, 15 August 2011

datasource - Grails how to call another database table? -



datasource - Grails how to call another database table? -

example : have 2 db : db1 , db2

and have 2 domain in app,

class domain1 { string test domain2 domain2 static mapping = { datasource 'db1' } } class domain2 { static mapping = { datasource 'db2' } }

when seek save class domain1, error "an unmapped class" how save domain1 class? thanks

you cannot have foreign key in 1 db referencing in db. that's why grails refuses map such relation.

replace field domain2 domain2 integer domain2id , command relation object in db2 database manually.

grails datasource multiple-databases

No comments:

Post a Comment