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

Emmanuel Bernard emmanuel at hibernate.org
Tue Jan 5 06:01:29 EST 2010


Done.

On 4 janv. 2010, at 12:49, Sanne Grinovero wrote:

> Hi,
> just checked that it is already proxying all of:
>                      org.hibernate.classic.Session.class,
> 	        org.hibernate.engine.SessionImplementor.class,
> 	        org.hibernate.jdbc.JDBCContext.Context.class,
> 	        org.hibernate.event.EventSource.class
> 
> so the patch is actually a one-liner to add the method name to the whitelist.
> 
> I've created HHH-4749 for this, if someone objects please comment there.
> Also it would be usefull if we could apply this on 3.3 branch too as
> it's affecting current Search users and I don't think existing code is
> otherwise changing behaviour. WDYT?
> 
> I'll be offline the rest of this week for Seam courses, at
> internet-less location :-/
> 
> Sanne
> 
> 2010/1/4 Emmanuel Bernard <emmanuel at hibernate.org>:
>> We are not proxying SessionImplementor but only Session.
>> so we would need to
>>  - proxy SessionImplementor and Session
>>  - whitelist getListeners
>> 
>> I don't see any issue to that. If nobody objects we can move forward.
>> 
>> On 4 janv. 2010, at 01:16, Sanne Grinovero wrote:
>> 
>>> 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
>>> _______________________________________________
>>> hibernate-dev mailing list
>>> hibernate-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>> 
>> 





More information about the hibernate-dev mailing list