gerb wrote:
hi denis,
thank you for your help!
welcome
gerb wrote:
hi denis,
one more thing:
there is no such column as the key of the map!? where is it persisted?
@MapKey allows to specify what property of the referenced entity should be used as a map key. Entity id is used by default (i.e.
Title id in your case). You may specify any other property as well. The property is stored/loaded in accordance with the mapping settings defined at the referenced entity (
'Title' in your case)
I.e. if you have
'Title.tracksNumber' property at the java level and want to define many-to-many mapping for Map<Integer/*tracks number*/, Title> with join table which columns are PKs of the
'Cd' and
'Title' entities, you can use the following mapping:
Code:
@MapKey(name = "tracksNumber")
@ManyToMany
@JoinTable(name = "titleList")
private Map<Integer, Title> titleList;