Once a session factory is created, the next step is to populate it with entities, embeddables, etc. Creating an element in a session factory results in creating the corresponding Java class, entries in the metadata files, and adding a node to the session factory in the Persistence tool window.
When you use the context menu commands, IntelliJ IDEA takes care of creating classes and members, providing annotations and adding the corresponding entries to the descriptor files.
When you create the Hibernate elements and members manually, it is the developer's responsibility to create the necessary declarations, annotations, and accessor methods. IntelliJ IDEA provides extensive coding assistance in the Java classes and metadata files.
- In the Persistence tool window, right-click the
desired session factory,
and choose element type from the context menu.
Click thumbnail to view larger image.
- In the dialog box that opens, specify class name and location, and click OK. For the entity listeners, specify the listener methods to be implemented, and the entity listener bindings.
- Further, to add members, right-click the desired element, and choose member type on the context menu.
- In the dialog box that opens, specify the member name and type. Where necessary, specify the target metadata files.
Use Alt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertCtrl+N or Alt+InsertAlt+InsertAlt+InsertCommand N or Control EnterControl N or Control EnterCommand N or Control Enter to create new elements and members.
- Creating Fields in Persistence Entities
- Creating Session Factory
- Creating Fields in Hibernate Elements
- Creating and Editing Relationships