[hibernate-dev] HHH-10500 and multiple associations using the same foreign key column

Stephen Fikes sfikes at redhat.com
Mon Feb 15 13:10:48 EST 2016


On Sat, 2016-02-13 at 13:56 -0800, Gail Badner wrote:
> JPA 2.1 spec says this for the description of @JoinColumn( name="..."
> )
> when used for a unidirectional one-to-many association:
> 
> "If the join is for a unidirectional OneToMany mapping using a
> foreign key
> mapping strategy, the foreign key is in the table of the target
> entity."
> 
> Is "the table of the target entity" just a default that can be
> overridden
> by the "table" attribute? If so, then this is a bug in Hibernate.

Both the 2.1 and 2.0 specs' definition for the 'table' attribute
mention:

"If the join is for a unidirectional OneToMany mapping using a foreign
key mapping strategy, the name of the table of the target entity."

It seems like the table would be implicitly known (and would not need
to be explicitly specified) in a case where the column does reside in
the default target entity table. Does the existence of the 'table'
attribute not suggest something other than the default case? Curious
about what other meaning the table could have here if not to specify a
table other than the default target entity table.


More information about the hibernate-dev mailing list