-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Hibernate Mapping Associated Entity?
PostPosted: Tue Jun 07, 2005 8:37 am 
Newbie

Joined: Mon May 30, 2005 12:07 pm
Posts: 3
Hello,

I got tables Product, Text and Language:
Primary Key underlined:

Product
product_id
text_id
price

Text
text_id
lang_id
text

Language
lang_id
description

I have absoultely no idea what the mapping file would look like. I tried chapter 24 of the reference but no example matched.
Maybe anyone knows and also knows the xdoclet-hibernate code for this example?

Thanks in advance
Rene


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 07, 2005 8:39 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Whats wrong with learning to do it yourself? After all somebody probably pays you to do it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 07, 2005 8:48 am 
Newbie

Joined: Mon May 30, 2005 12:07 pm
Posts: 3
Because it is not easy to find examples for this kind association. At least I found nothing. First, I tried to find examples, second, I experimented with mappings, third, I am trying to get help of more experienced users.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 07, 2005 8:57 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
It's two simple many-to-one mappings, the easiest kind. No, I won't write it for you.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 07, 2005 12:07 pm 
Newbie

Joined: Thu May 26, 2005 1:04 pm
Posts: 13
Take a look at the caveatemptor examples.
Look for CategorizedItem.java

You are looking for Category,CategorizedItem and Item classes.

You will also find the mappings and stuff in there.

_________________
RT


Top
 Profile  
 
 Post subject: Re: Hibernate Mapping Associated Entity?
PostPosted: Tue Jun 07, 2005 1:09 pm 
Newbie

Joined: Mon May 30, 2005 12:07 pm
Posts: 3
Thank you for your hints. But the given example doesnt match exactly in my opinion.

Product
product_id
price

ProductText
product_id
lang_id
text

Language
lang_id
description

would match.

My intention was a text table for different objects (not only product).

Anyway, I switched now to one text table for every object. Then I can apply the categorizedItems example.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.