Search code examples
grails-ormgrails-2.0

Does the multiple datasource feature of Grails 2.0 support relations?


I'm trying to support some legacy tables and I was able to create a domain that uses a separate datasource of those legacy tables.

However, when I try to use that domain from the separate datasource in a hasMany, it fails.

Is it possible to relate hasMany to a domain on a different datasource?


Solution

  • Unfortunately you can not have GORM automatically manage the association across multiple datasources. However, that said you can quite easily write the code that will accomplish what you are looking for and address some of the underlying performance issues with GORM at the same time. There is a very good example of this already.