wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Hibernate and class association Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate and class association" Watch "Hibernate and class association" New topic
Author

Hibernate and class association

ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 374
My current Traveling agent application system includes lot of class associations like

class Tour {
Flight f;
int i;
double d;
....
}

class Flight {
Log l;
int i;
double d;
....
}

class Log {
Date departure ;
Date arrival ;
....
}
The application and database start from scratch.
1. can we use hibernate to handle such complex chained object relation ? Can we easily get "Tour" information and grab all of the "Flight" and "Log" information associated with the "Tour" ?
2. should the tables be created in the same or different format from the above class struture ? which will be better ?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


1. can we use hibernate to handle such complex chained object relation ? Can we easily get "Tour" information and grab all of the "Flight" and "Log" information associated with the "Tour" ?

Yes.


2. should the tables be created in the same or different format from the above class struture ? which will be better ?

There is not really enough information here to say conclusively (Must tours have a Flight? Can they have more than one Flight? Can a Log exist independent of a Flight? etc.) but assuming the association is one to many for Tour to Flight and Flight to Log then it looks OK.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
wood burning stoves
 
subject: Hibernate and class association
 
Similar Threads
Need to create a dynamic table with dynamic name in hibernate....
When to call lock?
Price Itinerary
Inheritance; Problem with Test class
Re-arrange these numbers!