cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven Haiges <>
Subject Hibernate Session during CXF call
Date Thu, 17 Jul 2008 18:38:09 GMT
Hi all,

there must be a more elegant solution to an issue I have right now. I am using CXF to expose
a SOAP-based interface to our data layer. This means in my spring config, I got bith Hibernate
setup and also cxf. So calls would come in, hit the SOAP interface and the service implementations
are then referencing a dataAccess object that does the hibernate calls. 

This works fine, but I now experience the issue that I sometimes have to move around in my
domain model and then some collecitons, references, are not yet initialized. And as I call
those references from outside of the dataAccess (which opens and closes the hibernate session),
I easily get exceptions.

My current solution would be to move the hibernateTemplate (from dataAccess) into my service
implementation. During all operations, I would keep the session open till the very end. This
would work, but it also kind of breaks the separation of concerns paradigm I guess. 

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?


Sven Haiges
Y! Messenger / Skype: hansamann

View raw message