0

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

Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254

2 Answers2

1

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

Community
  • 1
  • 1
Dónal
  • 185,044
  • 174
  • 569
  • 824
0

Basing on @Donal Answer , i think on trick to resolve this issue :

Instead of :

class Project {

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

}

we will have:

class Project {

   Long addedById;
  //..................


   User addedBy(){

      User.get(this.addedById)  
   }

}

this means, we solve this issue in domain layer

Dónal
  • 185,044
  • 174
  • 569
  • 824
Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254