-->
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: Internationalization with hbm.xml files
PostPosted: Tue Jun 14, 2011 3:08 pm 
Beginner
Beginner

Joined: Sat May 21, 2011 7:40 am
Posts: 22
Hello out there!
I am facing a problem for which I can't find a solution on the web.
I want to have a language table which will be created from this hbm.xml file:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="com.blazebit.web.cms.model.Language" table="language" catalog="mydb">
        <id name="isoCode" type="string">
            <column name="lang_iso_code" length="3">
                <comment>The iso code of the language.</comment>
            </column>
            <generator class="assigned" />
        </id>
        <property name="iso2Code" type="string">
            <column name="lang_iso2_code">
                <comment>The isdo2 code of the language.</comment>
            </column>
        </property>
        <property name="name" type="string">
            <column name="lang_name">
                <comment>The name of the language.</comment>
            </column>
        </property>
    </class>
</hibernate-mapping>


After that I thought of mapping strings to the language table to get i18n strings. I used the following definition of a map:

Code:
<map name="description" table="language_text_map">
            <comment>The i18n description</comment>
            <key column="latemap_id" not-null="true"/>
            <map-key-many-to-many column="latemap_lang_id" class="com.blazebit.web.cms.model.Language"/>
            <element column="i18n_text" type="string"/>
        </map>


Somehow the hbm2ddl process does not generate a column for the resulting table of the class in which this map is defined. It generates foreignkeys like this:

Code:
alter table language_text_map
        add index FKFB399C51353D9ABA (latemap_id),
        add constraint FKFB399C51353D9ABA
        foreign key (latemap_id)
        references mydb.file (file_id);


The language_text_map id should reference every entity which uses the map? I am confused, shouldn't it be in the other direction?
What have i done wrong? Any typos or so?


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.