hibernate field of type map requires nullable = true
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.
精彩评论