我有这个:
@Column
@Convert(converter = MyMapConverter.class)
private Map<String, String> temp;
MyMapConverter是一个简单的JPA-AttributeConverter:
@Converter
public class MyMapConverter implements AttributeConverter<HashMap<String, String>, String> {
@Override
public String convertToDatabaseColumn(HashMap<String, String> attribute) {
return attribute.toString();
}
@Override
public HashMap<String, String> convertToEntityAttribute(String dbData) {
return ...
}
}
启动应用程序时,实际的hibernate版本会抱怨此错误:
Caused by: org.hibernate.MappingException: No type name
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:407)
at org.hibernate.tuple.PropertyFactory.buildStandardProperty(PropertyFactory.java:267)
at org.hibernate.tuple.component.ComponentMetamodel.<init>(ComponentMetamodel.java:54)
at org.hibernate.mapping.Component.getType(Component.java:169)
at org.hibernate.mapping.Property.getType(Property.java:68)
有什么问题?