Grails: Domain model relationships based on legacy database -


i'm creating grails application takes data existing legacy database (that's can't modified) , i'm trying wrap head around how represent table relationships in domain model classes.

here's sample data:

table 1 columns: pid, firstname, lastname, middlename table 1 id composite made of pid , lastname  table 2 columns: pid, emailaddress, phonenumber, faxnumber table 1 id composite made of pid, emailaddress, phonenumber  table 3 columns: pid, occupation table 3 id pid 

how represent these 3 tables , relationships (via pid column) domain model classes?

class table3{   string id, occupation }  class user implements serializable{   table3 pid   string firstname, lastname, middlename   static mapping = {         // need name maping:          id composite: ['pid', 'lastname']     }   //!!!add equals , hashcode } class profile implements serializable{   table3 pid     string emailaddress, phonenumber, faxnumber   static mapping = {         // need name maping:          id composite: ['pid', 'emailaddress', 'phonenumber']     }   //!!!add equals , hashcode } 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -