Hi,
I try to implement i18n support and I found this solution in the web:
http://www.jroller.com/craiger/entry/po ... _i18n_with
It's more or less this:
a) you have a table eg. product with the columns: id | name | name_fr | name_de ...
b) you create a bo:
Code:
@Entity
@Table(name = "products")
public class Product implements Serializable {
private long id;
protected String name;
public static class Product_fr extends Product {
public Product_fr(){
super();
}
@Column(name="name_fr")
public String getName(){
return name;
}
}
// Product_de
// ID
@Column(nullable = false)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
c) you map Product$Product_fr#name to name_fr column.
d) now in your DAO you search the language class inside the original class according to the language using in your application and now you can set the name-property the same way as it wasn't translated. (Product.get/setName).
Now my question is, how can I do this with annotations. Do I have to override getName() in the subclasses and add a (eg.) @Column(name="product_fr") annotation to each getter? (Like I did it)
Thanks for your reply!
logan