Two Laptop Bag*
The moose likes Object Relational Mapping and the fly likes How to map these tables to classes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to map these tables to classes?" Watch "How to map these tables to classes?" New topic
Author

How to map these tables to classes?

Rodrigo Bossini
Ranch Hand

Joined: Jul 03, 2009
Posts: 113
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
Posts: 113
Anyone? Please suggest.
 
 
subject: How to map these tables to classes?
 
Similar Threads
Passed Part One with 87%
My Study Notes
IBM 287 ICE TEST
IBM Exam 157 - Questions and Answers (Sample Exam)
Coding a 1 to N relationship. Question about OO Design and Implementation