hibernate - How do I annotate a Map<String, Entity> when the map key does not come from the entity -
i've read entries in forum discussing how annotate typed map hibernate , i've read hibernate docs referenced here. none of them answer question. code follows:
@onetomany @jointable(name="administrator_filters") private map<string, basefilter> filters;
i want use arbitrary string key map contains basefilter object (which 1 of entities) , store in join table. hibernate seems require property basefilter object key in map.
i see following error cannot define primary key constraint on nullable column in table 'administrator_filters'.
i've added nullable=false joincolumn elements in jointable , mapkey annotation, same error.
i add property basefilter containing map key, trying not that. hibernate docs say:
maps can borrow keys 1 of associated entity properties or have dedicated columns store explicit key.
but don't explain how use explicit key.
@mapkey(columns = {@column(name = "mapkeycolumn")} , targetelement = basefilter.class)
targetelement optional when using generic collections
Comments
Post a Comment