[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Object Relational Mapping
 
RSS feed
 
New topic
Author

How to map these tables to classes?

Rodrigo Bossini
Ranch Hand

Joined: Jul 03, 2009
Messages: 43

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?


I see wind mills
Rodrigo Bossini
Ranch Hand

Joined: Jul 03, 2009
Messages: 43

Anyone? Please suggest.

I see wind mills
 
jQuery in Action
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Object Relational Mapping
 
RSS feed
 
New topic
MyEclipse Enterprise Workbench