Skip to content

fallback id generator #511

Closed
Closed
@gavinking

Description

It would be very convenient to be able to specify a "fallback" id generator to use when @GeneratedValue has no generator member, and the entity does not explicitly declare any @TableGenerator or @SequenceGenerator. This fallback could even be per-GenerationType.

One way would be via a property setting, so that, for example, you could set:

jakarta.persistence.generator.AUTO = myDefaultSequenceGenerator
jakarta.persistence.generator.SEQUENCE = myDefaultSequenceGenerator
jakarta.persistence.generator.TABLE = myDefaultTableGenerator

But actually the most natural solution would be to let you declare a @TableGenerator or @SequenceGenerator with no name at the package level. And then that generator would be used as the fallback for the whole package.

That's a great solution, but I believe @lukasj mentioned he has some problems with us using package-level annotations.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status

      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions