Generate code
DataGrip provides multiple ways to generate common code constructs and recurring elements, which helps you increase productivity. These can be either file templates used when creating a new file, custom or predefined live templates that are applied differently based on the context, various wrappers, or automatic pairing of characters.
Generate a database entity
You can generate the following database entities: function, procedure, index, rule, trigger, view, materialized view, schema, database, role, user, sequence, enum, domain, composite type, foreign table, aggregate, operator, collation, foreign data wrapper, access method, extension table.
Click
or press Alt+Insert.Select the entity that you want to generate and press Enter.
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.
Right-click a database object for which you want to generate a Java entity class and navigate to
.In the file browser, specify the directory where you want to store JAVA class files
Example of a generated Java entity class: