If you are using JPA or Hibernate, you may want to associate your data sources with persistence units (in the case of JPA) or session factories (in the case of Hibernate). If you do so:

If the persistence units or session factories are generated by importing a database schema, the association between the corresponding persistence units or session factories and the data source is set automatically.

To associate a data source with a persistence unit or session factory
  1. Open the Persistence tool window (e.g View | Tool Windows | Persistence).
  2. Right-click the necessary module, persistence unit or session factory, and select Assign Data Sources in the context menu.
  3. In the Assign Data Sources dialog that opens, click the Data Source field and select the necessary data source. (To remove the association with the data source, select <none>.)

See Also

Web Resources: