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 Mapping Tables Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "Mapping Tables " Watch "Mapping Tables " New topic
Author

Mapping Tables

Lisa Carter
Greenhorn

Joined: May 29, 2003
Posts: 25
Hi,

I have 2 tables that have a one to many relationship. 1 table has the main data with a PK, One table has detials that contains the fk. The the details tables has a relationship to a look up table using a type field. The lookup table has an order field, type field and a description field. What I'd like to do is to order the main table by the order field in the lookup table for one of the properties in the main table mapping file. Is it possible to do this and if so, how? Any help is greatly appreciate.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Which ORM tool are you using?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Lisa Carter
Greenhorn

Joined: May 29, 2003
Posts: 25
Sorry about that I'm using hibernate 3.0
Sebastian Hennebrueder
Ranch Hand

Joined: Sep 09, 2004
Posts: 49
Hello Liza,
sorry but I did not understand as well. You speak about two tables and in your text you have 1+1+ a referencing table.
May be you should detail your question like:
table a (
id int,
someText varchar(255),
primary key(id)
)
table b(
id int,
foreign_key_to_a int,
...

You may have a look in the Hibernate reference as well. There are quite some examples.

Best Regards Sebastian


Things get always more complicated as expected.<br />Author of eBook Hibernate 3 Developer Guide by example<br />Tutorials about Hibernate, EJB, Struts, JSF <a href="http://www.laliluna.de" target="_blank" rel="nofollow">www.laliluna.de</a>
 
 
subject: Mapping Tables
 
Threads others viewed
jaws.xml configuration not loading for cmp entity beans
One to Many relationship
OneToMany Unidirectional strange behavior ?
Hibernate many-to-many mapping
"No identifier specified" when using InheritanceType.JOINED
developer file tools