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

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

Closed
gavinking opened this issue Sep 8, 2022 · 0 comments
Closed

Comments

@gavinking
Copy link
Contributor

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

@Entity classes

An entity class must:

  • be toplevel
  • be non-final
  • have a no-arg constructor (public/protected)
  • have properties declared public/protected

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:

  • be public
  • have a no-arg constructor (public)
  • have properties declared public/protected
  • be serializable
  • declare equals/hashCode

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant