-->
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: database localization / keys while <key property-ref/>
PostPosted: Fri Oct 19, 2007 4:23 am 
Beginner
Beginner

Joined: Mon Feb 19, 2007 4:22 am
Posts: 22
Location: Poland
Hello,

We are developing web application that supports localization including localized objects in database. The idea is to have a map (locale => value) for each property in object that needs multilanguage value.

We prepared this kind of collection-of-elements mapping for an object:
Code:
<property name="nameResourceId" type="int" column="name_resource_id" />

<map name="name" table="resource" cascade="all,delete-orphan" >
   <key column="resourceId" property-ref="nameResourceId" />
   <map-key type="string" column="locale" />
   <element column="value" type="string" />
</map>


This map contains localized property values keyed by a locale.

We use property-ref as there may be more than one localized property in the object, so we can have a few "resource identifiers" in an object (like mentioned above 'nameResourceId') .

It seems to work fine, but we figured out some performance issues:
    1. Table 'resource' has no primary key - we would like to use it for fast updates.
    2. Hibernate does not generate index for 'resource.resourceId' column, what makes joins inefficient

After some research we have not found a way to
    1. suggest Hibernate to generate and use primary key on 'resource' table,
    2. suggest Hibernate to generate index on 'resource.resourceId' (well, we can do it by hand, but it would be nice to have this done automaticly)


Is there any way to solve above problems? Maybe some of you has already touched a problem of localization in Hibernate and can provide some hints?


Hibernate version: 3.2.5
Name and version of the database you are using:MySQL 5.0


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 19, 2007 5:22 am 
Beginner
Beginner

Joined: Mon Feb 19, 2007 4:22 am
Posts: 22
Location: Poland
Ok, we are blind.

Hibernate creates composite primary key for key in map ('locale' in our case) and property-ref id ('nameResourceId' in our case).


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.