Mapping to EJB
If your module has an EJB facet enabled, you can map the tables of a data source to the entity beans.
To map java objects to a data source by entity beans
- In the Persistence tool window, right-click the desired module with the JPA facet, or one of its persistence units, and choose on the context menu. The Import Entity EJBs 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 EJB facet to be mapped. To do that, in the Choose EJB Facet field, click the ellipsis button, and select the desired EJB facet from the tree of modules that contain EJB facets.
- Define the target files to be generated. If you have invoked the
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). command on a module
node, specify the persistence unit to which the generated mapping will be added.
- Click OK.