title: Grails: With the datasources plugin, having trouble connecting domain classes across different datasources
body: <p>I'm using the datasources pluging for Grails described here: <a href="http://burtbeckwith.com/blog/?p=70" rel="nofollow">http://burtbeckwith.com/blog/?p=70</a></p>
  
  <p>I'm connecting to 2 MySQL database schemas on the same server: my_schema_1 and my_schema_2. Most of the data I need comes from my_schema_1, but one of its tables contains a column that references one of the tables in my_schema_2.</p>
  
  <p>Here are my datasource definitions in my Datasources.groovy file (simplified):</p>
  
  <pre><code>datasources = {
      datasource(name: 'my_schema_1') {
          domainClasses([Question, Answer])
          driverClassName('com.mysql.jdbc.Driver')
          url('jdbc:mysql://test.myserver.com/my_schema_1')
          username('***')
          password('***')
      }
  
      datasource(name: 'my_schema_2') {
          domainClasses([Genre])
          driverClassName('com.mysql.jdbc.Driver')
          url('jdbc:mysql://test.myserver.com/my_schema_2')
          username('***')
          password('***')
      }
  }
  </code></pre>
  
  <p>Here are my 3 class definitions:</p>
  
  <pre><code>class Question {
      String text
      Answer answer
      Genre genre
  }
  
  class Answer {
      String text
  }
  
  class Genre {
      String name
  }
  </code></pre>
  
  <p>Whenever I try to perform a criteria query on the Question class, I get the following mapping exception:</p>
  
  <pre><code>An association from the table question refers to an unmapped class: Genre
  </code></pre>
  
  <p>If I comment out the genre property in the Question class, everything works fine. If I perform a criteria query on the Genre class itself,
  everything works fine. There just seems to be a problem joining the 2 classes across schemas. (Of course, it's also very possible I missed
  something or did something incorrectly.)</p>
  
  <p>Am I doing something wrong or is this a limitation of the datasources plugin? And, if this is a limitation of the plugin, what alternatives could I use to achieve what I need?</p>
  
  <p>Any help/suggestions are much appreciated.</p>
  
  <p>Thanks,</p>
  
  <p>B.J.</p>