Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Transactional services / Spring integration

Service classes or methods should be marked @Transactional to provide access to the underlying Hibernate Session / SessionFactory.


Frequently executed HQL queries should be specified in @NamedQueryS on the relevant persistent entity/bean. The hibernate DAOs then reference the appropriate NamedQuery within their methods.

Useful tools

To run HQL queries and inspect the hibernate setup within Eclipse you can install the hibernate tools Eclipse plugin from JBoss by adding this update site to your Eclipse plugins registry (under Help -> Software Updates) -

You'll need to configure the plugin appropriately by providing the locations to the src/main/webapp/WEB-INF/hibernate.cfg.xml and files.

Hibernate Collections

In order to remove an entity from a one-to-many or many-to-many relationship you must:

  1. remove that entity from the persistent collection that it belongs to, e.g.,

    Code Block
    TemporalTerm temporalTerm = ...;