Generate Persistence Mapping - Import dialogs
From the Persistence tool window: Right-click a module, persistence unit or session factory, point to Generate Persistence Mapping and select the necessary option.
Specify the settings for generating entity classes and object/relational mappings for them. Depending on the option that you selected, one of the following is used as a source:
- A database schema represented by a data source.
- An EJB facet, if exists in the current project, or, to be more exact, the deployment descriptor file ejb-jar.xml associated with that facet. (Only the <entity> elements are processed.)
- Only for JPA: a Hibernate object/relational mapping file (.hbm.xml). The file should be within the current project.
|Choose Data Source||
When importing a database schema:
Specify the data source
to be used as a source of import.
opens the Data Sources and Drivers dialog which lets you create a new data source.
|Choose EJB Facet||
When importing an EJB facet: Specify the EJB facet to be used as a source.
opens the dialog which lets you select the facet. (The EJB facets available in the current project are suggested.)
|Choose Hibernate XML||
When importing a Hibernate object/relational mapping file:
Specify the |
opens the dialog which lets you select the file. (The corresponding file must be available in the current project.)
The destination package for your entity classes.
opens the dialog which lets you select an existing package, or create a new one ().
|Entity prefix||One or more characters to be used as a prefix for your entity class names.|
|Entity suffix||One or more characters to be used as a suffix for your entity class names.|
|Prefer primitive types||
When importing a database schema: Prefer primitive field types to object types
(e.g. when |
|Show default relationships||When importing a database schema: If this check box is selected, IntelliJ IDEA analyzes the foreign keys in the tables and suggests to create corresponding relationships (e.g. one-to-one, one-to-many).|
Database Schema Mapping
This section is available only when importing a database schema.
Select the tables and columns to be mapped. Edit the names of the entity classes and their persistent fields (the Map As column). Adjust the field types (the Mapped Type column). Use the toolbar for working with relationships and performing other tasks.
|Create a new relationship between the entities. (The Add Relationship dialog will open.)|
|Edit the selected relationship. (The Edit Relationship dialog will open.)|
|Delete the selected relationship.|
|Refresh the database schema.|
|Select all the tables, fields and relationships.|
|Deselect all the tables, fields and relationships.|
|Expand all the nodes in the table.|
|Collapse all the nodes in the table.|