Hibernate Search does not integrate well with the Spring Framework - FullTextSessionImpl
needs fixes
----------------------------------------------------------------------------------------------------
Key: HSEARCH-148
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-148
Project: Hibernate Search
Issue Type: Bug
Components: engine
Affects Versions: 3.0.0.GA
Reporter: Michael Lossos
We are integrating Hibernate Search (3.0.0 GA) into an existing Hibernate / Spring
Framework / Eclipse RCP configuration. Unfortunately, Hibernate Search's
FullTextSessionImpl assumes that it will be passed an org.hibernate.classic.Session. When
using Spring for Hibernate transaction management, Spring creates a defensive Proxy that
disables the Session.close() method. This Proxy does not implement the EventSource nor
classic.Session, while Hibernate Search assumes that it does and has a ClassCastException
in the FullTextSessionImpl constructor.
Hibernate Search's FullTextSessionImpl does this which is wrong for the Spring
Hibernate Session Proxy:
public FullTextSessionImpl(org.hibernate.Session session) {
this.session = (Session) session; // classic.Session!
this.eventSource = (EventSource) session;
this.sessionImplementor = (SessionImplementor) session;
}
It should be possible to rewrite FullTextSession and FullTextSessionImpl so that they do
not use the org.hibernate.classic.Session but instead use the standard Hibernate Session,
and thus avoid the unsafe casting.
The workaround for this is to use HibernateTemplate.setExposeNativeSession( true ) before
executing the HibernateCallback (causing the SessionImpl to be passed directly, without a
Proxy). This exposes the Session to potential close() and is *not* a good idea.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira