Hi Ian,

just wanted to let you know it works perfectly. I did a small test and 
referenced far away objects (multiple getter calls) that would never have been 
reachable before, so the Session is clearly open and all is good. 

Still the implementor and implementorClass seem a bit confusing to me. The CXF 
documentation just looses one sentence about each... I can see that implementor 
points to the proxied bean while implementorclass still lists the real 
implementation class. Can you bring a bit more light into this case? Why is 
that needed? I mean why does the jaxws:endpoint know more than the proxy?

Cheers
Sven

 ---
Sven Haiges
Y! Messenger / Skype: hansamann



----- Original Message ----
From: Ian Roberts <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, July 18, 2008 3:48:13 AM
Subject: Re: Hibernate Session during CXF call

Sven Haiges wrote:
> What I actually need is something like the Spring
> OpenSessionInViewInterceptor just for CXF calls. A new Hibenrate
> session should be opened with each incoming call ot a service method
> and closed after completion.
> 
> Is this available fro CXF? If not, would it be diffcult to implement?

Spring's HibernateInterceptor should do what you're after:

<bean id="hibernateInterceptor" 
class="org.springframework.orm.hibernate.HibernateInterceptor">
   <property name="sessionFactory" ref="..." />
</bean>

<bean id="realServiceImpl" class="my.service.Impl">
   ...
</bean>

<bean id="serviceImpl"
       class="org.springframework.aop.framework.ProxyFactoryBean">
   <property name="target"><ref local="realServiceImpl"/></property>
   <property name="interceptorNames">
     <list>
       <idref local="hibernateInterceptor" />
     </list>
   </property>
</bean>

<jaxws:endpoint implementor="#serviceImpl" 
implementorClass="my.service.Impl" ... />

Ian
-- 
Ian Roberts               | Department of Computer Science
[EMAIL PROTECTED]  | University of Sheffield, UK

Reply via email to