Example : i have 2 db : db1 and db2
and i have 2 domain in my app,
class domain1 {
String test
Domain2 domain2
static mapping = {
datasource 'db1'
}
}
class domain2 {
static mapping = {
datasource 'db2'
}
}
when i try to save class domain1, i get error "an unmapped class" how to save domain1 class? thanks
You cannot have a foreign key in one DB referencing something in another DB. That's why Grails refuses to map such a relation.
Replace your field Domain2 domain2
by Integer domain2Id
and control its relation to an object in the db2
database manually.