[hibernate-dev] Integrator and retrieving objects

Steve Ebersole steve at hibernate.org
Sun Apr 24 22:30:01 EDT 2011


Just to circle back to this (because my memory is so short)..

What did we ever decide about this, especially in regards to the *how*?

As and example, lets look at Search.  Search wraps Session in a 
FullTextSession.  Search would register some handler with the 
SessionFactory that says it knows how to handle Session.as( 
FullTextSession.class ) calls.  But what exactly is this handler going 
to do?  Unless Search maintains some global Session instance -> 
FullTextSession instance...  Or are you thinking the registration 
happens per-Session?


On 04/06/2011 09:28 AM, Emmanuel Bernard wrote:
> yes as is indeed better.
>
> On 6 avr. 2011, at 13:29, Steve Ebersole wrote:
>
>> A phrase I see a lot here is "as":
>>
>> session.as( AuditReader.class ).someEnversSpecificMethod()
>>
>> or
>>
>> session.as( FullTextSession.class )...
>>
>>
>> On 04/06/2011 06:26 AM, Adam Warski wrote:
>>>
>>> On Apr 6, 2011, at 1:20 PM, Steve Ebersole wrote:
>>>
>>>> The phrase 'unwrap' might be a bit misleading there because you may not be dealing with wrapped objects.  But the idea itself is still solid I believe.  Think of it more as a multi-directional cast
>>>
>>> Right, the idea sounds good; so it would be something like a per-session service? :)
>>> Envers could use it as well, right now just as search has Search.getFullTextSession, envers has AuditReaderFactory.getFor
>>> So we could have session.service(AuditReader.class / FullTextSession.class).
>>>
>>> Adam
>>>
>>>> On Apr 6, 2011 6:15 AM, "Adam Warski"<adam at warski.org>   wrote:
>>>>>
>>>>>> FullTextSession ftSession = session.unwrap(FullTextSession.class);
>>>>>> //the current approach is via some static helper method
>>>>>> //FullTextSession ftSession = Search.getFullTextSession(session);
>>>>>>
>>>>>> That would mean that the integration point between HSearch and Hibernate would have an unwrap method and Hibernate would delegate the unwrap calls to each integrator until a non null object is returned.
>>>>>>
>>>>>> It's just a thought, WDYT?
>>>>>
>>>>> But while EntityManager wraps a Session object, a Session doesn't wrap a FullTextSession, but the other way round, no?
>>>>>
>>>>> --
>>>>> Adam Warski
>>>>> http://www.warski.org
>>>>> http://www.softwaremill.eu
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> hibernate-dev mailing list
>>>>> hibernate-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>
>>
>> --
>> Steve Ebersole<steve at hibernate.org>
>> http://hibernate.org
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>

-- 
Steve Ebersole <steve at hibernate.org>
http://hibernate.org



More information about the hibernate-dev mailing list