[hibernate-dev] Use @AssociationOverride with @MapKeyJoinColumn

Vlad Mihalcea mihalcea.vlad at gmail.com
Wed Nov 23 10:08:10 EST 2016


The JPA spec does not specify a way to override the MapKeyJoinColumn. You
can override the association, like the JoinColumn for a ManyToOne or a
JoinTable for OneToMany.

In your case, maybe it's better to move that association out of the
embeddable.
It's always a good idea to keep the model as simple as possible.

Vlad

On Wed, Nov 23, 2016 at 4:10 PM, Florian Lacreuse <florian.lacreuse at smile.fr
> wrote:

> Hi,
>
> We have a problem using @AssociationOverride and @MapKeyJoinColumn and
> we would like to have your opinion about this to know if this is an issue.
>
> Here is the test case :
> https://github.com/florianlacreuse/hibernate-test-case
>
> Short explanation about the model : an entity with an embeddable field
> wrapping a map with an entity as key and a basic type as value.
>
> We use @AssociationOverride to rename the join table (annotation on
> embeddable field) and @MapKeyJoinColumn to rename the column related to
> the key map (annotation on map field).
>
> Unfortunately, it would seem that the @MapKeyJoinColumn annotation is
> ignored. @AssociationOverride may override any other annotations on the
> map field ? In this case how to rename the column related to the key map
> with the @AssociationOverride ?
>
> Is this an issue or is there any trick we don't know about?
>
> Thanks for your help.
>
> Kind regards,
>
>
> Logo <http://www.smile.fr/>
>
> 151 boulevard Stalingrad
> 69100 Villeurbanne
> www.smile.fr <http://www.smile.fr/>
> *Florian LACREUSE*
> Ingénieur d'études et développement
> Pôle Développement Spécifique Java
> Open Wide - Systèmes d'Information
> Email : florian.lacreuse at smile.fr <mailto:florian.lacreuse at smile.fr>
>
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev


More information about the hibernate-dev mailing list