To activate Java persistence on a bean class, we can use the @Entity annotation, which lets us map the bean to a database table. The identifier field denoted by @Id is used to map the primary key column of the table. The mapping of a bean to a table can be done using annotations or XML, but here we will stick to using annotations. One entity instance can be considered as representing one row of a table.
An entity mapping structure is shown here:
JPA Entity class |
Database Create Table structure |
@Entity @Table(name="task_detail") public class Task { @Id private Long ... |