Generate JPA Entity POJO from database table
- Right click on the table for generate a JPA Entity POJO or a Data Transfert Object POJO
- Choose the path where to store the java file
- The Java class is generated
Example of the User DTO class:
- You can capitalize table name and column name in annotation
- You can add
@GeneratedValue
annotation over column which have auto increment sequence (H2, Microsoft SQL Server, MySQL and PostgreSQL) - You can add
@ManyToOne
and@JoinColumn
annotations on columns with foreign key - You can generate composite primary key with
@IdClass
or@EmbeddedId
annotations
You can change the JPA mapping and add new ones