-->
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.  [ 1 post ] 
Author Message
 Post subject: Mappin problem using non-unique key
PostPosted: Tue Jul 25, 2006 7:50 am 
Newbie

Joined: Tue Jul 25, 2006 7:25 am
Posts: 1
I have the following problem I'd like to map to my objects using hibernate:

DB-Scheme:

Code:
Table Product
   ID   
   Title
   Category

Table ProductDescription
   ID
   KEY
   Name
   Description
   Language

Table Product_ProductDescription (Crosstable)
   Product.ID
   ProductDescription.KEY


The special Thing is the ProductDescription.Key. I'll use it to identify the Descriptions which contain to the same product (but in different languages). So the combination of 'Key' and 'Language' is always unique.

Is it possible to map it to objects like:

Code:
class ProductDescription {...<nothing fancy> }

class Product {

  @Id
  long ID;

  String title;

  @what comes here??
  ProductDescription description;  // only one descriptione as it is always used together with language


I could map ProductDescription using a Collection and a ManyToMany mapping. But then I have to many information in my objects which I will never use.
Or should I use the ManyToMany mapping and remove the not used descriptions before use?

I'm interested in your comments

best regards
Daniel


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

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.