我正在使用内部使用JPA annotatons和hibernate映射对象的dropwizard。其中一个对象都有我所定义的地图领域的无法使用JPA注释映射哈希映射
@Column
@ElementCollection(targetClass=String.class)
Map<String, String> routes;
我一直看到下面的错误
org.hibernate.MappingException: Could not determine type for: java.util.Map, at table
我已经尝试了一些关于SO
新增提到的事情@MapKey
注释 添加注释获取者 更改映射到HashMap似乎没有解决它。
你想在哪里坚持这个地图?成列?成一个(加入)表?成串行化列? “targetClass”试图做什么?你有在字段上定义的泛型,所以targetClass是无关紧要的 –
是作为表序列化的一列 –
在这种情况下,您可以尝试'@ Lob',或者使用'@ AttributeConverter'就像这个链接http:// www .datanucleus.org/products/accessplatform_5_1/jpa/mapping.html#one_many_map_converter_simple_simple –