|
Hibernate is not reading the annotations from the subclass, for this reason in the stacktrace the error comes from SimpleValue and not from org.hibernate.mapping.Component, the only solution is deleting the annotation @MappedSupperclass
Code example:
Children:
@Entity @Table(name = "product") public class Product extends LocalizedEntity<Product.LocalizedFields> { ... @ElementCollection(fetch = FetchType.EAGER) @JoinTable(name = "product_locale", joinColumns = @JoinColumn(name = "product_id", nullable = false)) @MapKeyType(value=@Type(type="org.hibernate.type.LocaleType")) @MapKeyClass(value = Locale.class) @MapKeyColumn(name = "locale", length = 12, nullable = false) @BatchSize(size = 100) @Fetch(FetchMode.SELECT) @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public Map<Locale, LocalizedFields> getLocalizedFields() { return super.getLocalizedFields(); }
@Embeddable public static class LocalizedFields { private String name;
@Column(name = "name", length = 500, nullable = false) public String getName() { return name; }
... } }
Super class:
@MappedSuperclass public abstract class LocalizedEntity<T> implements serializable { .... private Map<Locale, T> localizedFields = new HashMap<Locale, LF>();
public Map<Locale, T> getLocalizedFields() { return localizedFields; }
... }
Stacktrace:
Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Map, at table: product, for columns: [org.hibernate.mapping.Column(localizedFields)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:349) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:322) at
|