Hello,
here's my setup: {code} @Entity(name = "product") public class Product extends BaseProduct {
@ElementCollection(targetClass = LocalizedValue.class) @CollectionTable(name = "product_description_lv", joinColumns = @JoinColumn(name = "product_id"), indexes = { @Index(name = "idx_" + "product_description_lv", columnList = "product_id") }, foreignKey = @ForeignKey(name = "fk_" + "product_description_lv")) @MapKeyColumn(name = "locale") private Map<Locale, LocalizedValue> description; {code}
where {{LocalizedValue}} is: {code} @Embeddable @Access(AccessType.FIELD) public class LocalizedValue {
@Lob @Column(length = 50000, name = "val") private String value; {code}
I create one {{Product}} assign two values for it's description ( one has value {{ first entry is <Locale.ENGLISH, null }} > and the other one has value {{ second is <Locale.GERMAN, " test }} "> ). Then I select the product from the database, and inspect the {{description}} map - the result is it only has 1 element in the map - the {{ <Locale.GERMAN, " test }} value "> one .
I will create a test project soon. |
|