|
Hi,
I'm trying to implement some simple multilanguage support, but have failed so far.. perhaps someone here can give me a clue.
The setup, stripped down to the relevant information, is very simple: A Tour object can have a title and a description, available in multiple languages.
The database-setup is like this:
create table TOUR_TOUR(
ID INTEGER not null,
...)
create table TOUR_TEXT(
TOUR_ID INTEGER not null,
LANGUAGE VARCHAR(2) not null,
TITLE VARCHAR(80) not null,
DESCRIPTION VARCHAR(500) not null)
For TOUR_TEXT, a class named TourText with getters/setters for all the fields exists. The class Tour contains a set of instances of TourText, also accessible with setText(Set tourtext) and the matching getter.
Here's my hibernate mapping for this scenario:
<class name="Tour" table="TOUR_TOUR">
<!-- irrelevant lines stripped -->
<set name="text" table="TOUR_TEXT" inverse="true" lazy="true">
<key column="ID"/>
<one-to-many class="TourText"/>
</set>
</class>
<class name="TourText" table="TOUR_TEXT">
<composite-id >
<key-property name="id"/>
<key-property name="locale" column="LANGUAGE"/>
</composite-id>
<property name="title" column="title"/>
<property name="description" column="description"/>
</class>
In a JUnit test, I create a new Set with a single TourText object, assign it to a newly created tour, and make it persistent. However, only the tour object shows up in the database itself - no tourtext tupel is being created. I switched all logging to debug, but there are no error messages.
If somebody has any idea what's missing, I'd highly appreciate that!
Regards,
sen
_________________ "The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents."
Nathaniel Borenstein (1957 - )
|