sqlite - Implementing database from UML -


i modeled uml diagram involves associations. let's code is:

public class seller{     private int idseller;     private string name;     private string passw;     private list<phone> phones = new arraylist<phone>();      public seller() {                }      public seller(int idseller, string name, string passw, list<phone>phones) {         super();         this.idseller = idseller;         this.name = name;         this.passw = passw;         this.phones = phones;     }      //getters , setters } 

and

public class phone {     private int idphone;     private string description;     private string number; //will have chars in      public phone() {     }      public phone(int idphone, string description, string number) {         super();         this.idphone = idphone;         this.description = description;         this.number = number;     }      //getters , setters } 

i don't want limit numbers of phones sellers can have, excerption of whole code.

now, need create sqlite database , insert data in it, i'm bit confused on how i'll represent association uml database.

if wasn't working oo put foreing key in phone table referring seller's id owns phone, concept of oo makes me doubt right way here.

i have understanding of uml, first time try implement uml diagram , load data database. can please me saying what's right way it?

i think need read on database theory. extremely simple schema write- pretty hello world of schemas. don't think terms of uml or oo- wrong terms thinking data. need think in terms of how data makes sense organize. programmer's job map objects later.

you have 2 tables. table 1 table of sellers. has id (which primary key), name, password (which should stored in hash form, not in plaintext). second table of phones. has id (primary key), number, , owner field type int foreign key on seller id.

when need load data code- first load seller structures (other array) query on table 1. query table 2 phones matching seller id, , loop on returns adding phone array.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -