0

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

rsijaya
  • 159
  • 2
  • 14

1 Answers1

0

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.

eugene82
  • 8,432
  • 2
  • 22
  • 30