graemerocher opened a new issue, #14655:
URL: https://github.com/apache/grails-core/issues/14655

   Original Reporter: danyer
   Environment: Not Specified
   Version: Not Specified
   Migrated From: http://jira.grails.org/browse/GRAILS-4637
   
   This is a new feature suggestion for embedded classes, which their original 
mappings could be overriden in the host classes. See how I think that will 
could be.
   
   I defined  domain classes with two embedded classes: 
   
   {code}
   class A { 
       Aa aa 
       Bb bb
       static embedded = ['aa','bb'] 
       // overridden the default mapping for class Aa 
       static mapping = { 
           aa {
               columns { 
                   aa1 column: 'A_AA_ONE' 
                   aa2 column: 'A_AA_TWO' 
               } 
           }
       } 
   
   }
   class B { 
       Aa aa 
       Bb bb
       static embedded = ['aa','bb'] 
       // overridden the default mapping for class Bb 
       static mapping = { 
           bb {
               columns { 
                   bb1 column: 'B_BB_ONE' 
                   bb2 column: 'B_BB_TWO' 
               } 
           }
       } 
   }
   
   class Aa { 
       String aa1 
       String aa2 
       static mapping = { 
       // default mapping for class Aa 
           columns { 
               aa1 column: 'AA_ONE' 
               aa2 column: 'AA_TWO' 
           } 
       } 
   }
   
   class Bb { 
       String bb1 
       String bb2 
       // default mapping for class Bb 
       static mapping = { 
           columns { 
           bb1 column: 'BB_ONE' 
           bb2 column: 'BB_TWO' 
           } 
       } 
   } 
   {code}
   
   In the generated table, I expect something like this:
   
   {code:SQL}
   create table PUBLIC.A ( 
       ID BIGINT not null, 
       VERSION BIGINT not null, 
       A_AA_ONE VARCHAR(255) not null, 
       A_AA_TWO VARCHAR(255) not null, 
       BB_ONE VARCHAR(255) not null, 
       BB_TWO VARCHAR(255) not null, 
       primary key (ID) 
   ); 
   
   create table PUBLIC.B ( 
       ID BIGINT not null, 
       VERSION BIGINT not null, 
       AA_ONE VARCHAR(255) not null, 
       AA_TWO VARCHAR(255) not null, 
       B_BB_ONE VARCHAR(255) not null, 
       B_BB_TWO VARCHAR(255) not null, 
       primary key (ID) 
   ); 
   {code}
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to