Hi All ...
How do you think about this possible new feature of Hibernate ...
Problem and here decision:
1) Your need localize some data of your bean (ru / en)
2) Writing default object.
Code:
public class Article {
String title;
String text;
...........
}
3) In configuration file you declare locales.
Code:
<locales>
<locale default="true">ru</locale>
<locale>en</locale>
</locales>
)
4) In class mapping you declare columns, that you want to localize.
Code:
<hibernate-mapping>
<class
name="Article"
table="ARTICLE">
......
<property
name="title"
column="TITLE"
localize="true"
type="string" />
<property
name="text"
column="TEXT
type="string"
localize="true"
length="500"/>
</class>
</hibernate-mapping>
5) After execution Hibernate To DDL will be create next table
Code:
CREATE TABLE ARTICLE (
TITLE_RU VARCHAR(...)...,
TITLE_EN VARCHAR(...)...,
TEXT_RU VARCHAR(...)...,
TEXT_EN VARCHAR(...)...
)
6) For communication with object will be using default mechanism (default locale) or with locale setting.