Search code examples
grailsgrails-ormmulti-database

Cannot build Relationship between two tables from different databases


I have the following use case:

  • [User.groovy]: is mapped to user table in auth mysql Database .

  • [Project.groovy] : is mapped to project table in pm mysql database

When i add this relationship between the 2 classes

class Project {

   User addedBy;
  //..................

}

i've got this error :

An association from the table project refers to an unmapped class: abdennour.auth.User


Solution

  • In general, you can't have primary-foreign key relationships between tables in different databases.