-->
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.  [ 2 posts ] 
Author Message
 Post subject: artificial one-to-one
PostPosted: Wed Aug 08, 2007 3:03 am 
Newbie

Joined: Mon Jun 11, 2007 5:45 am
Posts: 8
Hello, I have the following situation:

I have a product with several translations, placed in the database under product and producttranslation tables.

Now, I would like to map a property for product for the current user's translation of the product. (If I want all the translations, we get those independently).

Since the database relation between this tables is not one-to-one but one-to-many, I was wondering if there's a possibility to force the one-to-one by giving an extra criterium to the relation mapping?

Tnx, Bert


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 08, 2007 10:01 am 
Expert
Expert

Joined: Fri Jul 13, 2007 8:18 am
Posts: 370
Location: london
You can't have a property of product that would return a different value based on the current user. Why don't you just have a method in product that returns a single translation given the current user's language?
Code:
ProductTranslation getProductTranslation(user.getLanguage());

Or have I misunderstood you?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.