开发者

hibernate field of type map requires nullable = true

开发者 https://www.devze.com 2023-03-04 09:36 出处:网络
Using hibernate 3.6.3.Final I have this Mapping in an entity. @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)

Using hibernate 3.6.3.Final I have this Mapping in an entity.

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) 
@JoinColumn(name = "policy_id", referencedColumnName = "id", nullable = false)
@MapKeyColumn(name = "document_type", nullable = true) 
@MapKeyEnumerated(EnumType.STRING)
private final Map<DocumentType, PolicyDocument> poli开发者_如何学编程cyDocuments = new HashMap<DocumentType, PolicyDocument>();

But I want to know why I have to have the MapKeyColoum as nullable = true.

I don't want insert then update type queries.

If I change it to nullable false I get no default value for document type.

0

精彩评论

暂无评论...
验证码 换一张
取 消