OpenSessionInView and LazyInitializationException

2008-05-07 Thread Tomasz Prus
I had such configuration:

?xml version=1.0 encoding=UTF-8?
web-app id=WebApp_ID version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=
http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;

context-param
param-namecontextConfigLocation/param-name
param-value/WEB-INF/carpartswebsite-servlet.xml/param-value
/context-param

listener

listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
/listener

servlet
servlet-namecarpartswebsite/servlet-name

servlet-classorg.springframework.web.servlet.DispatcherServlet/servlet-class
load-on-startup1/load-on-startup
  /servlet

  servlet
servlet-namewicket/servlet-name

servlet-classorg.apache.wicket.protocol.http.WicketServlet/servlet-class
init-param
param-nameapplicationFactoryClassName/param-name

param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
/init-param
load-on-startup1/load-on-startup
/servlet

  servlet-mapping
servlet-namewicket/servlet-name
url-pattern/*/url-pattern
  /servlet-mapping

  servlet
servlet-nameXFireSOAPServlet/servlet-name

servlet-classorg.codehaus.xfire.spring.XFireSpringServlet/servlet-class
load-on-startup1/load-on-startup
/servlet

servlet-mapping
servlet-nameXFireSOAPServlet/servlet-name
url-pattern/services/*/url-pattern
/servlet-mapping

  filter
filter-nameOpenSessionInViewFilter/filter-name

filter-classpl.mainseek.car.commons.CarPartsOpenSessionInViewFilter/filter-class
  /filter

  filter-mapping
filter-nameOpenSessionInViewFilter/filter-name
url-pattern/*/url-pattern
  /filter-mapping

welcome-file-list
welcome-fileindex.jsp/welcome-file
welcome-fileindex.html/welcome-file
  /welcome-file-list
/web-app


.. and this was working, but when i've changed servlet mapping to filter
mapping:

?xml version=1.0?
web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=
http://www.w3.org/TR/xmlschema-1/;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
version=2.4
context-param
param-namecontextConfigLocation/param-name
param-value/WEB-INF/carpartswebsite-servlet.xml/param-value
/context-param

listener

listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
/listener

!--servlet
servlet-namecarpartswebsite/servlet-name

servlet-classorg.springframework.web.servlet.DispatcherServlet/servlet-class
load-on-startup1/load-on-startup
  /servlet--

filter
filter-nameWicketFilter/filter-name

filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
init-param
param-nameapplicationFactoryClassName/param-name

param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
param-nameapplicationBean/param-name
param-valuewicketApplication/param-value
/init-param
/filter
filter-mapping
filter-nameWicketFilter/filter-name
url-pattern/*/url-pattern
dispatcherREQUEST/dispatcher
dispatcherERROR/dispatcher

error-page
error-code404/error-code
location/404/location
/error-page
/filter-mapping

!--servlet
servlet-namewicket/servlet-name

servlet-classorg.apache.wicket.protocol.http.WicketServlet/servlet-class
init-param
param-nameapplicationFactoryClassName/param-name

param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
/init-param
load-on-startup1/load-on-startup
/servlet

  servlet-mapping
servlet-namewicket/servlet-name
url-pattern/*/url-pattern
  /servlet-mapping--

  servlet
servlet-nameXFireSOAPServlet/servlet-name

servlet-classorg.codehaus.xfire.spring.XFireSpringServlet/servlet-class
load-on-startup1/load-on-startup
/servlet

servlet-mapping
servlet-nameXFireSOAPServlet/servlet-name
url-pattern/services/*/url-pattern
/servlet-mapping

  filter
filter-nameOpenSessionInViewFilter/filter-name

filter-classpl.mainseek.car.commons.CarPartsOpenSessionInViewFilter/filter-class
  /filter

  filter-mapping
filter-nameOpenSessionInViewFilter/filter-name
url-pattern/*/url-pattern
  /filter-mapping

welcome-file-list
welcome-fileindex.jsp/welcome-file
welcome-fileindex.html/welcome-file
  /welcome-file-list
/web-app

.. it doesn't work. I get the org.hibernate.LazyInitializationException.

Please, help me !!! :)


Re: OpenSessionInView and LazyInitializationException

2008-05-07 Thread Wouter Huijnink

You need to declare the opensessioninviewfilter *before* the wicket filter

--
Wouter Huijnink
Func. Internet Integration
W http://www.func.nl
T +31 20 423
F +31 20 4223500


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OpenSessionInView and LazyInitializationException

2008-05-07 Thread lars vonk
To be more precise: the opensessioninview filter's filter-mapping element
needs to be declared before the wicket filter's filter-mapping element.

Lars

On Wed, May 7, 2008 at 2:35 PM, Wouter Huijnink [EMAIL PROTECTED] wrote:

 You need to declare the opensessioninviewfilter *before* the wicket filter

 --
 Wouter Huijnink
 Func. Internet Integration
 W http://www.func.nl
 T +31 20 423
 F +31 20 4223500


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]