title: One-To-One mapping in Grails
body: <p>Can someone please help me to figure out how to create domain classes for simple one-to-one mapping in grails !</p>
  
  <p>let say we have 2 tables (oracle): </p>
  
  <pre><code>create table table_a(long_common_id_name number(5) primary key using index, 
                       notes varchar2(10 byte), 
                       update_seq number(3)not null );
  
  create table table_b (long_common_id_name number(5) primary key using index, 
                        extra_notes varchar2(200 byte), 
                        update_seq number(3) not null);
  
  alter table table_b add (constraint table_b_fk foreign key (long_common_id_name)
  references table_a (long_common_id_name));
  </code></pre>
  
  <p>I created 2 domain classes: </p>
  
  <pre><code>class TableA {
      static mapping = {
          table 'table_a'
          columns {
              id                  column:'LONG_COMMON_ID_NAME'
              data                column:'NOTES'
              version             column:'UPDATE_SEQ'
          }
      }
      String data
      TableB extraData
  }
  
  class TableB {
      static mapping = {
          table 'table_b'
          columns {
              id                  column:'LONG_COMMON_ID_NAME'
              data                column:'EXTRA_NOTES'
              version             column:'UPDATE_SEQ'
          }
      }
      String data
  }
  </code></pre>
  
  <p>This particular definition  is not correct. Grails (or Hibernate) builds an incorrect SQL for TableA : </p>
  
  <pre><code>select this_.LONG_COMMON_ID_NAME as LONG1_66_0_, this_.UPDATE_SEQ as UPDATE2_66_0_, this_.NOTES as NOTES66_0_, this_.extra_data_id as extra4_66_0_ from table_a this_
  </code></pre>
  
  <p>I've tried many things: belongsto , hasManey with unique but nothing seems to work. </p>
  
  <p>Thanks in advance.</p>