Mapping to Hibernate
To map Java objects to a data source by hibernate mappings
- 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.
- 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.
- 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 , 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 , 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).
- Click OK.