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?