Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow @JoinColumns without an explicit @JoinColumn list #639

Open
gavinking opened this issue Jun 16, 2024 · 0 comments · May be fixed by #638
Open

Allow @JoinColumns without an explicit @JoinColumn list #639

gavinking opened this issue Jun 16, 2024 · 0 comments · May be fixed by #638
Labels
candidate-for-4 Good candidate for JPA 4

Comments

@gavinking
Copy link
Contributor

A semi-hidden function of the @JoinColumns annotation is to specify a @ForeignKey. Unfortunately, you're required to specify an explicit list of child @JoinColumns even when all you want to do is name the foreign key.

(All this also applies to @PrimaryKeyJoinColumns.)

Possible fixes:

  1. specify value default {}, with the interpretation that the @JoinColumns are defaulted , or
  2. allow @ForeignKey as a top-level annotation on association mappings (and joined inheritance mappings).

Option 2 minimizes verbosity. But at the cost of being a bit inconsistent with how @UniqueKey, @CheckConstraint, and @Index work.

PR #638 implements option 1, which has minimal impact.

@gavinking gavinking linked a pull request Jun 16, 2024 that will close this issue
@gavinking gavinking added the candidate-for-4 Good candidate for JPA 4 label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
candidate-for-4 Good candidate for JPA 4
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant