-
Notifications
You must be signed in to change notification settings - Fork 59
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
"entity local" @SequenceGenerator/@TableGenerator #406
Comments
gavinking
added a commit
to gavinking/jpa-api
that referenced
this issue
May 25, 2023
gavinking
added a commit
to gavinking/jpa-api
that referenced
this issue
May 25, 2023
gavinking
added a commit
to gavinking/jpa-api
that referenced
this issue
May 25, 2023
gavinking
added a commit
to gavinking/jpa-api
that referenced
this issue
May 25, 2023
gavinking
added a commit
to gavinking/jpa-api
that referenced
this issue
Aug 7, 2023
lukasj
added a commit
that referenced
this issue
Aug 8, 2023
See #406 Co-authored-by: Lukas Jungmann <lukas.jungmann@oracle.com>
gavinking
added a commit
to gavinking/jpa-api
that referenced
this issue
Aug 29, 2023
…n spec I missed this ... it was only defined in the Javadoc see jakartaee#406
gavinking
added a commit
to gavinking/jpa-api
that referenced
this issue
Aug 29, 2023
…n spec I missed this ... it was only defined in the Javadoc see jakartaee#406
gavinking
added a commit
to gavinking/jpa-api
that referenced
this issue
Sep 4, 2023
…n spec I missed this ... it was only defined in the Javadoc see jakartaee#406
lukasj
pushed a commit
that referenced
this issue
Sep 4, 2023
…n spec I missed this ... it was only defined in the Javadoc see #406
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The spec says that a
@SequenceGenerator
and@TableGenerator
annotation defines a named generator whose name is global to the whole persistence unit.But a very common idiom is to specify one of these annotations directly on the
@Id
attribute or@Entity
class, and in that case it makes much more sense for the generator to be seen as local to the entity.I'm not completely sure how we should "fix" this, but one idea would be to make the
name
annotation member optional, and treat@SequenceGenerator
and@TableGenerator
annotations without a name as local to the entity, and used by default. For example:Or:
would now be accepted, and the
@SequenceGenerator
would be visible only to theBook
entity, and implicitly used as the generator for that entity.This would avoid the need for nastiness like:
and is more typesafe to boot (one less stringly-typed name).
The text was updated successfully, but these errors were encountered: