Do one of the following:
- Right click a persistence unit node in the Persistence tool window,
choose on context menu, and then select the desired element from the submenu.
Note
If your persistence unit is already mapped to a data source and contains a mapping file, IntelliJ IDEA displays the Select Metadata Target dialog box, where you can specify in which files you would like to create persistence information about the new elements. For example, you can opt to create an entry in your mapping file, an annotation in the source file of a class, or both. If a class doesn't exist, it will be created.
- Open persistence.xml for editing, locate the
code for the desired persistence unit, type an opening tag, and select the desired element
from the suggestion list:

Complete the package and class name. If a class doesn't exist, a quick fix will suggest to create it:

-
In the Project tool window, create a new Java class, and annotate it as
@Entity. If the necessary annotation imports are missing, press
Alt+EnterAlt+Enter to show the list of imports.

Select javax.persistence.Entity.
- Right-click a persistence unit node in the Persistence tool window, and choose on context menu, and specify the metadata targets.
- Right-click the newly created entity bean to add new persistence fields.
- To generate/update Entities from a database, right-click the persistence unit, and choose .

