-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping multiple columns to a UserType
PostPosted: Tue Sep 20, 2005 3:59 am 
Newbie

Joined: Tue Sep 20, 2005 3:41 am
Posts: 3
Hi everybody,

I've got a quite annoying problem with my collegues' database structure.
I've tried to solve this over and over again for half a year by now.

We have all kinds of entities with translatable properties, e.g. a Catalog with a translatable title.

That wouldn't be much of a problem, but the corresponding db-structure
is a column for every language, like:
ID | TITLE | TITLE_E | TITLE_D | TITLE_FR | etc...

Well, the database is generated during deployment depending on the configured languages.
Thus I don't know (at build-time) how many columns have to be read/written so I can't supply them in my UserType-Mapping.

Further I don't have access to our deployment tool, thus I can't generate the mapping at deployment.

Any Idea, how to implement a UserType with 'dynamically' calculated columns?
Or any other Idea, how to get the described DB-Structure (titles) into a Map-like object?

Thnx for any suggestions. ;)

P.S. Please excuse my bumpy english... I'm not a native speaker... ;)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 5:34 am 
Beginner
Beginner

Joined: Tue Jul 05, 2005 4:44 am
Posts: 40
Location: Paris, France
Hi !!

I think the idea to create one column by language is the bad idea.
In general, when you modelise database, you must have a fixed model.

For your problem,
you can create three table
Code:
->Book
  - Long id
->Language
  - Long id
  - String name
->Title
  - Long id
  - Book book
  - Language langage

With the modelisation, the model is fixed and can manage severals language.

++

_________________
Fred


Top
 Profile  
 
 Post subject: Bad DB Model - I Know ;-(
PostPosted: Tue Sep 20, 2005 6:03 am 
Newbie

Joined: Tue Sep 20, 2005 3:41 am
Posts: 3
Hi fedfil,

first of all: Thanks for you reply ;-)

Well, the problem is, that I'm stuck with that miserable DB model.
I'm not allowed to change that.

My colleagues are hacking low-level JDBC where this model is not really
a problem... The simply type "SELECT TITLE_" + language + " FROM someTable...", execute that and get the results from the ResultSet.

But they do it over and over and over again, for every bean, for every usecase, which IMHO is VERY errorprone and VERY VERY annoying.

I'd like to use Hibernate instead, but due to that F***ING DB model I've not been able to do so.

Time is running short, and I'm far from beeing finished... ;(

So I tried (for the first time of my life) to get the help I need from a forum.

so far,
Greez Windi ;)


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