[hibernate-dev] Allowing "getListeners" method in ThreadLocal wrapped Sessions

Sanne Grinovero sanne.grinovero at gmail.com
Sun Jan 3 19:16:34 EST 2010


Hello All,
when binding the Session to a thread (when using
org.hibernate.context.ThreadLocalSessionContext) it is currently
mandatory to start a transaction before any use of the session, this
includes currently Search.getFullTextSession, mandatory in order to
use Hibernate Search, as it uses getListener().
This behaviour was introduced since Search 3.1.1 to prevent other
trouble with code forgetting to start a transaction it will use
session.getListeners() as soon as the user calls getFullTextSession
(HSEARCH-178, which is a workaround for HHH-2763)

The method "getListeners" is not in the whitelist of allowed methods
on the session; could this be added?
I'm referring to the private class TransactionProtectionWrapper in
org.hibernate.context.ThreadLocalSessionContext, around line 330.

Could this also be applied to 3.3.x branch? it would help users of
Search using these core versions, while having no effect impact on
others uses.

Regards,
Sanne



More information about the hibernate-dev mailing list