Is there a clean solution for multilingual fields in JPA?
I think of this db structure:
tabular product
+---------+--------------+-----+ | Field | Type | Key | +---------+--------------+-----+ | id | bigint(20) | PRI | | price | varchar(255) | | +---------+--------------+-----+
table product_lang
+------------------+--------------+-----+ | Field | Type | Key | +------------------+--------------+-----+ | id | bigint(20) | PRI | | lang | varchar(3) | PRI | | title | varchar(255) | | | description | varchar(255) | | +------------------+--------------+-----+
And this is the class I would like to use:
@Entity public class Product { @Id public Long id; public Double price; public Locale lang; @Translateable public String title; @Translateable public String description; }
source share