Re: [hibernate-dev] Unidirectional @OneToMany @JoinColumn associations

2018-05-31 Thread Stephen Fikes
The only referenced column is one of the *primary* key columns. I left out the word "primary" in my previous reply. To make sure I understand, are you saying that a primary key column isn't a primary key column when part of a composite primary key? In other words, only the complete set of prima

Re: [hibernate-dev] Unidirectional @OneToMany @JoinColumn associations

2018-05-30 Thread Steve Ebersole
The spec says " referenced columns that are not primary key columns...". Nothing in here says full or partial. I completely agree with Sanne - its not a bug and it is something we have never supported. On Wed, May 30, 2018 at 3:44 PM Stephen Fikes wrote: > The referenced attributes *are* k

Re: [hibernate-dev] Unidirectional @OneToMany @JoinColumn associations

2018-05-30 Thread Stephen Fikes
The referenced attributes *are* key attributes .. just a subset of the key. So ... odd mapping ... but I don't think it is included in the "optional" category for JPA 2.x. Stephen On 05/30/2018 03:39 PM, Sanne Grinovero wrote: > Hi Gail, > > I would not consider it a bug to not have documented

Re: [hibernate-dev] Unidirectional @OneToMany @JoinColumn associations

2018-05-30 Thread Sanne Grinovero
Hi Gail, I would not consider it a bug to not have documented that we don't support some non-mandatory feature. And it's still optional in JPA 2.2, so I think we're good. Thanks, Sanne On 30 May 2018 at 19:45, Gail Badner wrote: > Hi Vlad, > > Thanks for your answer. There are definitely bet

Re: [hibernate-dev] Unidirectional @OneToMany @JoinColumn associations

2018-05-30 Thread Gail Badner
Hi Vlad, Thanks for your answer. There are definitely better ways to model this association. WRT the second example, where the referenced columns are a subset of the PK columns -- I understand there are better ways to model this. In particular, since the subset of PK columns needs to be unique (

Re: [hibernate-dev] Unidirectional @OneToMany @JoinColumn associations

2018-05-30 Thread Vlad Mihalcea
Hi, For the OneToMany with @JoinColumn, the user can workaround this limitation by just using the @ManyToOne on the child side on any column they want and turning the unidirectional association into a bidirectional one. I remember I tested it and it worked just fine. For the OneToMany with @Join

[hibernate-dev] Unidirectional @OneToMany @JoinColumn associations

2018-05-29 Thread Gail Badner
Unidirectional OneToMany associations using @JoinColumn that reference columns that are not PK columns is not currently supported. The JPA 2.1 documentation for @JoinTable says: "Support for referenced columns that are not primary key columns of the referenced table is optional. Applications that