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: Multilanguage problem (referencing a set)
PostPosted: Mon Apr 11, 2005 7:47 am 
Newbie

Joined: Wed Apr 06, 2005 3:42 am
Posts: 5
Location: Berlin
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 - )


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 11, 2005 8:39 am 
Newbie

Joined: Wed Apr 06, 2005 3:42 am
Posts: 5
Location: Berlin
Just discovered this article on the hibernate wiki('Some Parent-Child Principles'):
http://www.hibernate.org/209.html

This should do nicely, going to try it at asap..

_________________
"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 - )


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.