IntelliJ IDEA 13.1 Web Help

Some features described here are available in Ultimate edition only.

Hibernate session factory can be created in two ways:

To create a session factory using the Hibernate facet settings
  1. In the Project tool window, right-click the desired module, and choose Module Settings on the context menu.
  2. Under the desired module node, click its Hibernate facet.

    hibernateAddSessionFactory2.png

  3. In the Descriptors section, click add (Alt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+Insert or Ctrl+NAlt+InsertCommand N or Control EnterControl N or Control EnterCommand N or Control Enter) and select hibernate.cfg.xml. Specify the deployment descriptor location, and click Apply. A session factory is added to the list of data source mappings.
  4. In the Data Sources Mapping section, specify the data source for the new Hibernate session factory. To do that, select the entry for the new session factory column, double-click the corresponding data source in the Data Source column, and select one from the list of configured data sources.

    hibernateAddSessionFactory3.png

  5. Open the Hibernate configuration file in the editor, and configure connection properties, and the other properties as required.
To create a session factory in the Persistence tool window
  1. Open Persistence tool window.
  2. Under the Hibernate Facets node, right-click the desired module, and choose Session Factory on the context menu.

    hibernateAddSessionFactory1.png

  3. In the dialog that opens, select the desired Hibernate configuration file. If a file doesn't exist, click icon_newXmlFile.png, and specify the configuration file name and the target package. The source code of the new Hibernate configuration file opens in a separate tab in the editor, and in the Persistence tool window two nodes are created: for the configuration file, and for the corresponding session factory.
  4. Open the Hibernate configuration file in the editor, and configure connection properties, and the other properties as required. Note syntax highlighting, validation of references, and code completion provided by IntelliJ IDEA.

See Also

Concepts:

Procedures:

Web Resources: