DataGrip 2019.1 Help

Generating code

Generate Java entity classes for tables and views

To store point objects in the database by using JPA, you must define an entity class. A JPA entity class is a Java class that is annotated as having the ability to represent objects in the database (a POJO (Plain Old Java Object) class).

You can select the necessary tables and views and generate corresponding JAVA files.

  1. Right-click a database object for which you want to generate a Java entity class and navigate to Scripted Extensions | Generate POJOs.groovy.

  2. In the file browser, specify the directory where you want to store JAVA class files

Generate Java entity classes for tables and views

Example of a generated Java entity class

package com.sample; public class Actor { private long actorId; private String firstName; private String lastName; private java.sql.Timestamp lastUpdate; public long getActorId() { return actorId; } public void setActorId(long actorId) { this.actorId = actorId; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public java.sql.Timestamp getLastUpdate() { return lastUpdate; } public void setLastUpdate(java.sql.Timestamp lastUpdate) { this.lastUpdate = lastUpdate; } }
Last modified: 25 July 2019