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

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -