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

[java] Java Persistence API (JPA) Entity Rule: Non-Final Class #2856

Open
numeralnathan opened this issue Oct 22, 2020 · 0 comments
Open

[java] Java Persistence API (JPA) Entity Rule: Non-Final Class #2856

numeralnathan opened this issue Oct 22, 2020 · 0 comments
Labels
a:new-rule Proposal to add a new built-in rule

Comments

@numeralnathan
Copy link

numeralnathan commented Oct 22, 2020

Proposed Rule Name: JPANonFinalClass

Proposed Category: Bug

Description:

When a class is annotated with JPA's @Entity, there are certain requirements placed on the class. Please create a rule that requires the class to be non-final.

Note: Hibernate allows for final classes but lazy-loading will not work.

Code Sample:

The following class will cause a problem at runtime because it is final.

@Entity
final class MyEntity
{
...
}

The following class is correct.

@Entity
class MyEntity
{
...
}

Possible Properties:

  • allowPackage: Hibernate allows for package protected no-argument constructors
@numeralnathan numeralnathan added the a:new-rule Proposal to add a new built-in rule label Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:new-rule Proposal to add a new built-in rule
Projects
None yet
Development

No branches or pull requests

1 participant