Last active
September 20, 2021 14:43
-
-
Save dungdm93/62c36ca0bfab7749cbad to your computer and use it in GitHub Desktop.
[Java] [JPA] @mapkey example
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@CollectionTable
@OneToMany
@OneToMany
@ManyToMany
@MapKeyColumn
@MapKeyTemporal
@MapKeyEnumerated
@MapKeyJoinColumn
@MapKeyColumn
if the map key is a basic type.If you don't specify the column name, the name of the property is
«field»_KEY
@MapKeyEnumerated
/[@MapKeyTemporal
](https://docs.oracle.com/javaee/7/api/javax/persistence/MapKeyTemporal.html @MapKeyTemporal) if the map key type is respectively an enum or aDate
.@MapKeyJoinColumn
/@MapKeyJoinColumns
if the map key type is another entity.@ElementCollection
is required if the map value is a basic type.Corresponding config annotation are
@CollectionTable
and@Column
.@OneToMany
or@ManyToMany
.Corresponding config annotation is
@JoinTable
.