Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate and class association

 
ben oliver
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic