I map the attribute set to my entity using @CollectionOfElements. The goal here is to provide a list of metadata that can be used in a request to pull certain records.
I calculated the mapping and how to fulfill the queries that I want. The problem is that sleep mode will not save zero values!
@CollectionOfElements() @JoinTable(name = "plan_attribute", joinColumns = @JoinColumn(name = "plan_id")) @MapKey(columns = @Column(name = "attribute_name", nullable = false, length = 255)) @Column(name = "attribute_value", nullable = true, length = 255) public Map getAttributes() { return attributes; } public void setAttributes(Map attributes) { this.attributes = attributes; } public void addAttribute(String name, String value) { this.attributes.put(name, value); }
Eg. object.addAttribute ("someName", null); will not be saved
Does anyone have thoughts on how to do this without embedding the key / value pair object for the sole purpose of storing these values?
Hi,
collections hibernate
bcowdery
source share