Remove `HibernateInterceptor`

Due to a change in how Hibernate manages per-thread Sessions and
Spring's integration with this, the `HibernateInterceptor` is not
strictly necessary any longer.

More information on this ticket: https://jira.spring.io/browse/SPR-9028
Import `FilterDefinitionFactoryBean`

Spring is no longer supporting `FilterDefinitionFactoryBean` for
hibernate4, and the `filterDefinitions` property has been removed from
the `LocalSessionFactoryBean`. However, the same mechanisms using in the
`FilterDefinitionFactoryBean` and the various custom OMERO subclasses
should work. So this pulls the implementation of that bean into OMERO
and updates it for hibernate4 compatibility.
Update `MergeEventListener` for Spring+Hibernate4

The Spring team have stated that they will no longer be supporting the
`IdTransferringMergeEventListener` for hibernate4. However, the code
still works, so this just merges the (relatively small) implementation
of that listener with OMERO's `MergeEventListener`, which was the only
subclass in use.

See here for more info: https://jira.spring.io/browse/SPR-9634
Implement custom LocalSessionFactoryBean subclass

The hibernate4 version of Spring's `LocalSessionFactoryBean` has removed
support for specifying `eventListeners`, `filterDefinitions`, and
`lobHandler`. This is a simple custom subclass that adds back these
properties and wires them up appropriately. Notably, since Hibernate has
moved management of `eventListeners` to the `EventListenerRegistry`
which must be retrieved from the `ServiceRegistry`, we must call the
`buildSessionFactory` method *before* registering event listeners.

Note: It is still not clear to me how the `lobHandler` should be hooked
in, so it remains in the implementation as a property that can be
specified, but more work needs to go into connecting it appropriately.
moar hibernate too
Moar!
Update SimilarTerms for Hibernate 4

In Hibernate-Search for Hibernate 4, the mechanism for accessing an
index reader has changed. This updates the `SimilarTerms` class for the
new mechanism.
Rewrite EventListenersFactoryBean to work with EventListenerRegistry

The new mechanism in Hibernate 4 for registering event listeners
requires retrieving an `EventListenerRegistry` instance and then
registering listeners with it. So, this changes the implementation of
`EventListenersFactoryBean` from generating a map of event listeners to
directly registering them with the `EventListenerRegistry`, which is
passed in during session factory creation in the
`LocalSessionFactoryBean`.
Increase heap space for build