IntelliJ IDEA 2016.1 Help

Mapping to Hibernate

To map Java objects to a data source by Hibernate mappings

  1. In the Persistence tool window, right-click the desired module with the JPA facet, or one of its persistence units, and choose Generate Persistence Mapping | By Hibernate Mappings on the context menu. The Import Hibernate Mappings dialog box appears.
  2. In the General Settings section, specify the general mapping options (prefix and suffix of the new entity, the target package, etc.), and the Hibernate configuration file to be mapped. To do that, in the Choose Data Source field, click the ellipsis button, and select the desired Hibernate configuration file.
  3. Define the target files to be generated. If you have invoked the Generate Persistence Mapping | By Hibernate Mappings command on a module node, specify the persistence unit to which the generated mapping will be added.

    If you want to define persistence using metadata, select the check box Generate Mapping XML, and specify the name of the xml mapping file. To do that, click add.png, or press Shift+Enter, and specify the desired XML file in the dialog that opens.

    If the desired file doesn't exist, select the directory where a mapping file will be created, click icon_newXmlFile.png, and type the name of the new mapping file.

    If you want to define persistence using Java annotations, select the check box Generate JPA Annotations (Java 5).

  4. Click OK.

See Also

Last modified: 13 July 2016