Import Database Schema / Import Mappings
The dialog boxes Import Database Schema, Import Hibernate Mappings and Import Entity EJBs are used to create annotated Java classes and persistence metadata. The dialog boxes are similar, and the differences are specially marked.
General Settings
Item | Description | Available In |
---|---|---|
Choose Data Source | Use this field to select the data source to be mapped. You can select the desired data source from
the drop-down list of recent choices or click the Browse button ![]() | Import Database Schema |
Choose Hibernate XML | Use this field to select the Hibernate configuration file to be mapped. You can select the desired
Hibernate configuration file from
the drop-down list of recent choices, or click the Browse button ![]() | Import Hibernate Mappings |
Choose EJB Facet | Use this field to select EJB facet to be mapped. You can select the desired EJB facet from
the drop-down list of recent choices, or click the Browse button ![]() | Import Entity EJBs |
Package | Specify the target package where the mapping files will be generated. | All |
Entity prefix/suffix | Type the strings that will automatically prepend or appended to the persistence entity name according to the naming conventions accepted in your project. The entered strings are immediately previewed in the Map As and Mapped Type columns of the Database Schema Mapping section. | All |
Prefer primitive types | If this check box is selected, the import is performed into primitive types, rather than Object types. | Import Database Schema |
Show default relationships | If this check box is selected, IntelliJ IDEA analyzes foreign keys in the tables and suggests to create corresponding relationships. | Import Database Schema |
Database Schema Mapping
Item | Description | Available In |
---|---|---|
![]() | Click this button to open the Add Relationship dialog box and create a new relationship between persistence entities according to relations in the database schema. | Import Database Schema |
![]() | Click this button to change properties of the selected relationship in the Edit Relationship dialog box. | Import Database Schema |
![]() | Click this button to delete the selected relationship. | |
![]() | Click this button to refresh the database schema. | Import Database Schema |
![]() | Click this button to select all tables, fields, and relations and have IntelliJ IDEA involve them in the mapping generation. | Import Database Schema |
![]() | Click this button to clear selection of all tables, fields, and relations and thus exclude them from the mapping generation. | Import Database Schema |
![]() | Click this button to expand all table nodes. | Import Database Schema |
![]() | Click this button to collapse all table nodes. | Import Database Schema |
Add to Persistence Unit / Add to Session Factory | If the command has been invoked on a
module with the JPA or Hibernate facet, use this field to specify the target persistence entity or session factory.
To define the target persistence unit or session factory, click ![]() ![]() Otherwise, if the dialog box has been invoked from a persistence unit or session factory, the field becomes read-only, and shows the persistence unit or session factory selected in the Persistence tool window. | All |
Generate Column Properties | Select this check box to have properties of fields of the table reflected in the XML file or through annotations. | All |
The following options define the format used to maintain the mappings between the database tables and persistence entities. This may be an XML file or several XML files and/or JPA annotations. For the necessary mappings to be generated, at least one of the options should be selected. The options Generate Single Mapping XML and Generate Separate XML for Entity are mutually exclusive and cannot be selected at the same time. | ||
Generate Single Mapping XML |
Select this check box to have IntelliJ IDEA store object-relational mappings generated for all the entities in the persistence unit or session factory in one XML file. To define the target file:
| All |
Generate Separate XML for Entity |
Select this check box to have IntelliJ IDEA store object-relational mappings generated for each entity in a separate XML file. The generated files will have the names of the corresponding entities followed by | All |
Generate JPA annotation | Check this option to create mapping information as annotations in the source code of the entity classes. | All |