The phrase 'unwrap' here might be a bit misleading because you may not
always be dealing with wrapped objects. But the idea itself is still
solid I believe. Think of it as a multi-directional cast; you can
up-cast as well as down-cast.
We do need to be very very very careful about stack overflow here though.
On 04/06/2011 06:15 AM, Adam Warski 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?
Steve Ebersole <steve(a)hibernate.org>