jakartaee / persistence

https://jakartaee.github.io/persistence/
Other
191 stars 55 forks source link

Make the name member of @XxxxGenerator annotations optional #416

Closed gavinking closed 12 months ago

gavinking commented 1 year ago

See #406.

lukasj commented 1 year ago

add a line to appendixes.adoc/changelog

gavinking commented 12 months ago

the deafult name should be defined as: SEQUENCE_ENTITYNAME for the class level use annotation and SEQUENCE_ENTITYNAME_FIELDNAME for the field level use of the annotation

@lukasj after reviewing this and re-thinking it through properly this time, I realized that what we talked about isn't quite right, and I actually got it right the first time.

We need the generator name inferred for @GeneratedValue to line up with the name inferred for a @SequenceGenerator or @TableGenerator. Since the @GeneratedValue doesn't know what kind of generator it's looking for, nor where it's declared, the plain entity name is the right thing to use here.

If we want to nail down the actual inferred name of the database sequence or table when sequenceName or table is missing, that's something we could do, but it's an orthogonal question, since the spec currently doesn't constrain that at all. (It just says "Defaults to a name chosen by persistence provider".)

So I think we should merge this as-is.

Sorry for the confusion.

gavinking commented 12 months ago

add a line to appendixes.adoc/changelog

Done.