Creating Fields in Hibernate Elements
When a persistent field is added to an entity, the respective annotated properties are added to the source file of the entity class, the field is marked with a gutter icon in the editor, and the member nodes are added to the session factory node in the Persistence tool window , and to the ER diagram of the session factory.
Fields can be created in one of the following ways:
To create fields in the source code
- Open the desired entity class for editing.
- Type the desired field declaration:
- Create getter and setter methods. To do that, press Alt+Insert, and select Getter and Setter from the suggestion list:
- Annotate the field. If the required import is missing, use the suggested quick fix:
To create persistence fields using the entity context menu
- In the Persistence tool window, expand the Hibernate Facets node, and select the desired session factory.
- Under the session factory node, right-click Hibernate element you want to populate with fields, and choose New | <field > :
- In the dialog box that opens, specify the field name and type, and click OK.