@Entity (jpa)
The @jakarta.persistence.Entity is used by JPA to indicate that a class is a domain entity to be persisted to the database.
For example:
Customer.java
import jakarta.persistence.*;
@Entity (1)
public class Customer {
@Id (2)
@GeneratedValue(strategy = GenerationType.AUTO) (2)
@Column(name = "id", nullable = false) (2)
private Long id;
// ...
}
| 1 | Indicates that this entity is a JPA entity |
| 2 | JPA entities are required to declare an identifier. It’s very common for this to be a surrogate identifier, with the value assigned by the database when the object is persisted. |
Apache Causeway currently does not infer any other semantics from this annotation.
|
Causeway parses the |
See Also
-
@Entity (JPA API javadoc)