【发布时间】:2011-10-25 13:52:41
【问题描述】:
在 JPA 中是否有针对多语言字段的干净解决方案?
我想到了这个 db 结构:
餐桌产品
+---------+--------------+-----+
| Field | Type | Key |
+---------+--------------+-----+
| id | bigint(20) | PRI |
| price | varchar(255) | |
+---------+--------------+-----+
表product_lang
+------------------+--------------+-----+
| Field | Type | Key |
+------------------+--------------+-----+
| id | bigint(20) | PRI |
| lang | varchar(3) | PRI |
| title | varchar(255) | |
| description | varchar(255) | |
+------------------+--------------+-----+
这是我想使用的类:
@Entity
public class Product {
@Id
public Long id;
public Double price;
public Locale lang;
@Translateable
public String title;
@Translateable
public String description;
}
【问题讨论】:
标签: hibernate jpa internationalization playframework