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
Post a Comment