File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 370
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate and class association
 
Similar Threads
When to call lock?
Inheritance; Problem with Test class
Price Itinerary
Re-arrange these numbers!
Need to create a dynamic table with dynamic name in hibernate....