• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to map these tables to classes?

 
Rodrigo Bossini
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Here's my question about mapping tables from a relational db to java classes.

In my Relational DB I have the following:

One table Client, one table Message and one table Call.

One client can have N messages and one Message belongs to one single client.

One client can have N Calls and one Call belongs to one single client.

Calls and Messages do not relate.

So, the main activities from my application are:

- Sending the messages

-And notifying the calls.

So, for the sending messages activitie, I need a bean class Client that has a Collection<Message>.

And for the notifying calls activitie, I need a bean class Client that has a Collection<Call>.

So, what's the best way to solve this problem:

Here are the two manners I'm considering:

1 - Create one single Client class that has both a Collection<Message> and a Collection<Call.

2- Create one ClientMessage class that has a Collection><Message> and create another class, say, ClientCall that has a Collection<Call>.


What's the best option, and what is the most used normally?

 
Rodrigo Bossini
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone? Please suggest.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic