-->
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.  [ 8 posts ] 
Author Message
 Post subject: Hibernate3 i18n in an easy way?
PostPosted: Sun Sep 25, 2005 12:58 pm 
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:
<class
name="com.borneo.model.posting.Category"
table="CATEGORY"
lazy="false"
>

<id
name="id"
column="category_id"
type="java.lang.Long"
unsaved-value="null"
>
<generator class="increment">

</generator>
</id>

<version
name="version"
column="version"
type="java.lang.Integer"
/>

<property
name="name"
type="java.lang.String"
update="true"
insert="true"
>
<column
name="NAME"
length="50"
unique-key="UNIQUE_NAME_AT_LEVEL"
not-null="true"
/>
</property>

<many-to-one
name="parentCategory"
class="com.borneo.model.posting.Category"
cascade="none"
outer-join="false"
update="true"
insert="true"
foreign-key="FK1_PARENT_CATEGORY_ID"
>
<column
name="PARENT_CATEGORY_ID"
unique-key="UNIQUE_NAME_AT_LEVEL"
not-null="false"
/>
</many-to-one>

<set
name="childCategories"
lazy="false"
inverse="true"
cascade="all-delete-orphan"
sort="unsorted"
batch-size="10"
>

<key
>
<column
name="PARENT_CATEGORY_ID"
/>
</key>

<one-to-many
class="com.borneo.model.posting.Category"
/>

</set>

<set
name="categorizedItems"
lazy="false"
inverse="true"
cascade="all-delete-orphan"
sort="unsorted"
outer-join="false"
>

<key
>
<column
name="category_id"
length="16"
not-null="true"
/>
</key>

<one-to-many
class="com.borneo.model.posting.CategorizedItem"
/>

</set>

<property
name="created"
type="java.util.Date"
update="false"
insert="true"
column="created"
not-null="true"
/>

<property
name="expire"
type="java.util.Date"
update="true"
insert="true"
column="expire"
not-null="false"
/>

<set
name="categoryByCountry"
lazy="false"
inverse="true"
cascade="save-update"
sort="unsorted"
>

<key
column="fk_category_id"
>
</key>

<one-to-many
class="com.borneo.model.posting.CategoryByCountry"
/>

</set>

</class>



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

Hi guys,

Is there any easy way hibernate3 offer to internationalize a Category table other than the method show in this website http://www.theserverside.com/blogs/show ... ernational

As I found it too complicated and no complete code provided. But if anyone has the complete code for http://www.theserverside.com/blogs/show ... ernational
pls provide here, Thanks !

regards,
Mark


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 3:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what part of the code are you missing ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 26, 2005 8:32 am 
Regular
Regular

Joined: Mon Aug 02, 2004 9:33 am
Posts: 69
Hi Max,

My problem here is that I don't really how to implement the i18n, which described at http://www.theserverside.com/blogs/show ... ernational
Can anyone pls kind provide the codes and the hbm.xml files here for reference. Thanks in advance !

regards,
Mark


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 26, 2005 9:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well the mappings, source code and examples are all there in the article.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 26, 2005 11:25 am 
Regular
Regular

Joined: Mon Aug 02, 2004 9:33 am
Posts: 69
No the code provided ter is incomplete and I really confuse about the code. Can someone kindly provide the Label.java, Category.java, Label.hbm.xml, Category.hbm.xml here?
Thanks in advance !

regards,
Mark


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 26, 2005 11:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ah you are missing the Label.getCode, Label.getDescription implementations - well, that is system specific code that performs the lookup.

Could be anything you want.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 3:28 am 
Regular
Regular

Joined: Mon Aug 02, 2004 9:33 am
Posts: 69
Hi,

Appreciate very much if u could provide the code here, Thanks in advance !

regards,
Mark


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 3:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
sorry - can't see how to do a map.get(key); will help you ;)

Seriously, I don't have an example laying around and if you just want examples of how to write i18n programs then go look for all the opensource programs that has this.....applying the hibernate design pattern in the article should then be trivial.

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.