It sounds as though you are developing your database as you write your program. In my experience it generally works better to think very hard about the data that your program will use, and develop a database that will hold that data and make it easy to get at information your program will need often BEFORE YOU START DOING ANY real coding. Prototyping is a good way of getting information from users that will help you decide on the requirement for your data design.
In this case, if you had thought carefully in advance you would have realized that a customer might have multiple phone numbers, each of a specified type (cell, fax, work, home, etc.) and that you might want a description field (this home phone is only valid from May 1 - October 31). You might also have considered the possibility that one phone number could be associated with multiple people (members of the same family might share a single home phone number). You would then have come up with a data design like this: create table People { PersonId, name, etc. } create table Phone (PhoneId, name, PhoneTypeId, etc.) create table PhoneType (PhoneTypeId, code - home, work, cell, fax, etc.) and here is the main point create table Person_Phone (id, PersonId, PhoneId, description) Now that you have the data design if you generate entity tables everything works just fine. Bill Gordon On Mar 30, 2009, at 12:38 AM, poplar wrote: > > Hi all, > > I have a problem for adding a new column in OneToMany relationship > table. I create 2 entities: Customer and Phone, 1 customer may have > many phone, therefore I use @OneToMany annotation before Collection > <Phone>, the result after deploying is that a table called Customer- > Phone has been automatically created with 2 columns are the primary > keys of Customer and Phone. Now I want to add a column for example > Description, but I don't know how to do. Could you please help me? Any > idea is welcome. > > Thanks and B.R, > Poplar > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en -~----------~----~----~----~------~----~------~--~---