I'm writing an application where all String properties must be localized, i.e. they must store a different value for every available Locale. A quick solution would be to use a Map, which can be easily mapped in Hibernate but isn't nice on the Java programmer:

public class Product {
   private Map<Locale, String> description;
   private Map<Locale, String> note;

I therefore implemented a LocalString object that can hold different strings for different locales:

public class LocalString {
   private Map<Locale, String> localStrings;

The domain object becomes

public class Product {
   private LocalString description;
   private LocalString note;

How do I best map these objects with Hibernate annotations?

I think the best mapping would be done using LocalString as a component:

@Embeddable
public class LocalString {
    private Map<Locale, String> localStrings;

    @ElementCollection
    public Map<Locale, String> getLocalStrings() {
       return localStrings;
    }

...

@Entity
public class Product {
   private Long id;
   private LocalString description;
   private LocalString note;

   @Embedded
   public LocalString getDescription() {
          return description;
   }

All is fine so far: the hbm2ddl ant task creates two tables, a "Products" table and a "Products_localStrings" table which contains key and value columns. Everything breaks when I add the getter for the second property:

   @Embedded
   public LocalString getNote() {
          return note;
   }

The second property doesn't show up in the schema. I tried using the @AttributesOverride tag to define different names for the two columns, but the generated schema is not correct:

   @Embedded
   @AttributeOverrides({
          @AttributeOverride(name="loca
Edit
Report