I would like to have something like this be generated from hbm2ddl:
______________ ______________ _______________
|Language | |I18N |
I know my question is very old, but probably someone finds this and wants to know how to do that!
Well my final solution is creating embedded or composite elements within a map. Pretty easy, but you have to know how to do that. Here is an example on how to do that with annotations:
@Entity
@Table(name="A")
public class A implements Serializable{
private Map<Locale, LocalizedA> localized = new HashMap<Locale, LocalizedA>();
@ElementCollection
@CollectionTable(name = "localized_a")
@MapKeyJoinColumn(name = "field_name_for_locale")
public Map<Locale, LocalizedA> getLocalized() {
return this.localized;
}
public void setLocalized(Map<Locale, LocalizedA> localized) {
this.localized = localized;
}
}
@Embeddable
public class LocalizedA implements java.io.Serializable {
@Column(name = "field_name_for_description")
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
}
I hope this will help someone, if you want an example for hbm.xml files just comment and i will add that.