-->
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: Make Category POJO to support multiple languages?
PostPosted: Thu Sep 08, 2005 11:14 am 
Regular
Regular

Joined: Mon Aug 02, 2004 9:33 am
Posts: 69
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0.5

Mapping documents:

<hibernate-mapping package="org.hibernate.auction.model">

<class name="Category"
table="CATEGORY"
lazy="true">

<!-- Common id property. -->
<id name="id"
type="long"
column="CATEGORY_ID"
unsaved-value="null"
access="org.hibernate.auction.persistence.DirectSetAccessor">
<generator class="native"/>
</id>

<!-- A versioned entity. -->
<version name="version"
column="VERSION"
access="net.sf.hibernate.property.DirectPropertyAccessor"/>

<!-- Name is limited to 255 characters.-->
<property name="name"
type="string">
<column name="NAME"
not-null="true"
length="255"
unique-key="UNIQUE_NAME_AT_LEVEL"/>
</property>

<!-- We can't change the creation time, so map it with update="false". -->
<property name="created"
column="CREATED"
type="java.util.Date"
update="false"
not-null="true"
access="org.hibernate.auction.persistence.DirectSetAccessor"/>

<!-- Parent can be null for root categories. -->
<many-to-one name="parentCategory"
cascade="none"
outer-join="false"
foreign-key="FK1_PARENT_CATEGORY_ID">
<column name="PARENT_CATEGORY_ID"
not-null="false"
unique-key="UNIQUE_NAME_AT_LEVEL"/>
</many-to-one>

<set name="childCategories"
cascade="all-delete-orphan"
inverse="true"
lazy="true"
batch-size="10"
access="org.hibernate.auction.persistence.DirectSetAccessor">
<key column="PARENT_CATEGORY_ID"/>
<one-to-many class="Category"/>
</set>

<set name="categorizedItems"
cascade="all-delete-orphan"
inverse="true"
outer-join="false"
access="org.hibernate.auction.persistence.DirectSetAccessor">
<key foreign-key="FK1_CATEGORIZED_ITEM_ID">
<column name="CATEGORY_ID" not-null="true" length="16"/>
</key>
<one-to-many class="CategorizedItem"/>
</set>


</class>

</hibernate-mapping>

Name and version of the database you are using: MySql 4.1

Hi guys,

I am refering to the Category POJO from CaveatEmptor (caveatemptor-0.9.5). Anyone could kindly suggest how to make it support multipls languages? It is bcoz if the user wanna view my website in other language such as France, then I gotta retrieve the category's name in France language from database.

Is it the best way to create another table to hold multiple languages and refer back to the Category table id?

TIA !

regards,
Mark


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 08, 2005 11:35 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Use the regular user forum. Also see this blog entry: http://blog.hibernate.org/cgi-bin/blosx ... /i18n.html


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.