According to the JPA specification, Entity
is a Java class that meets the following requirements:
- Annotated with
@Entity
annotation - Has no-args constructor
- Is not final
- Has an ID field (or fields) annotated with
@Id
As you can see, ID is required. Why is that?