1

I have this:

@Column
@Convert(converter = MyMapConverter.class)
private Map<String, String> temp;

MyMapConverter is a simple 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 ...
    }

}

When starting the application, actual hibernate version complains with this error:

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)

What is wrong?

nimo23
  • 5,170
  • 10
  • 46
  • 75
  • read this https://stackoverflow.com/questions/11948895/how-to-automatically-serialize-and-deserialize-json-string-using-jpa-and-hiberna/47053807#47053807 – Youcef LAIDANI Jan 10 '18 at 13:29
  • 1
    Thanks. I think, I found the reason for this error: "private Map temp;" is part of a "composite Id". And using "AttributeConverter" on such cases are not allowed. When putting "private Map temp;" as normal property, all works. However, I need to use it as a part of a "composite id". – nimo23 Jan 10 '18 at 16:40

0 Answers0