difficulties Mapping maps with hibernate using JPA annotations -


there possibly fundamental don't understand semantics of jpa @mapkey element. trying save map has entity keys , entity values. schema auto generated hibernate. generates join table maps values entities containing entity (that has map property) , ignores keys. treats collection of values , ignores keys, far can tell. missing here ? thank you

@entity public class practicemap {     @javax.persistence.onetomany(cascade = cascadetype.all)     @javax.persistence.mapkey      public map<keysample, valuesample> getmap1() {         return map1;     }      //more unrelated/standard bits here    } 

look @ javadoc of @mapkey - it's used when need treat particular fields of value entity keys.

if key , value should different entities, need use @mapkeyjoincolumn (introduced in jpa 2.0).


Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -