jakartaee / persistence

https://jakartaee.github.io/persistence/
Other
196 stars 58 forks source link

revisit restrictions on entity, embeddable, and primary key classes #380

Closed gavinking closed 1 year ago

gavinking commented 2 years ago

Reviewing the spec, I'm wondering whether we should revise some restrictions on user code.

@Entity classes

An entity class must:

But this leads me to wonder why static inner classes are prohibited?

@Embeddable classes

Embeddable classes have the same restrictions as entity classes.

But I would have expected that an embeddable class should be non-abstract.

And I don't see any reason why static inner classes should be prohibited.

Primary key classes

A primary key class must:

Why must a primary key class be public when we don't apply this restriction to embeddables?

Is the requirement for serializability really necessary? (Yes, I remember where this came from, but I don't believe it's relevant anymore.)

Surely a primary key class should always be non-abstract.