Hi Ricardo

You can also get into these errors if you do not use detachable models, and not use extended persistence context (if using JPA).. BTW using extended persistence context are not recommended, due to performance reasons AFAIK..

Ricardo Mayerhofer wrote:
Hi Yann,
Thanks for your response. The problem occurs when I try to load an entity in
a WebPage object. A common solution for this is to use Open Session in View filter, but it
didn't work.
So I found the problem. I was manually creating a spring context to inject
objects in the web page. The right thing to do is to use wicket spring
integration:
http://cwiki.apache.org/WICKET/spring.html


Yann PETIT wrote:
Hi Ricardo,

May be I'm wrong but this kind of exception has nothing to do with Wicket.

This exception is usually sent by Hibernate when trying to load a
collection
with lazy option to true on a detached object.

I'd be a great help if you could post your mapping file, the stacktrace of
the exception and maybe a few code lines where the exception occured if
this
is in your code and not in wicket sources.
(may you'll find more help on an hibernate list )

Regards,

Yann PETIT



2008/10/26 Ricardo Mayerhofer <[EMAIL PROTECTED]>

Hi all,
I'm getting a LazyInitializationException when using wicket + spring +
hibernate. I'm declaring Open Session in View filter before wicket
filter.
My configurations goes bellow. Any help is appreciated:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app 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";
        version="2.4">

       <display-name>StopW</display-name>

        <!--
             There are three means to configure Wickets configuration
mode
and
they are
             tested in the order given.
             1) A system property: -Dwicket.configuration
             2) servlet specific <init-param>
             3) context specific <context-param>
             The value might be either "development" (reloading when
templates
change)
             or "deployment". If no configuration is found, "development"
is the
default.
       -->

   <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>
           classpath*:dataContext.xml,classpath*:applicationContext.xml
       </param-value>
   </context-param>


       <listener>


<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
       </listener>

       <filter>
               <filter-name>OpenSessionInViewFilter</filter-name>
               <filter-class>

 org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
               </filter-class>
       </filter>

       <filter-mapping>
               <filter-name>OpenSessionInViewFilter</filter-name>
               <url-pattern>/*</url-pattern>
       </filter-mapping>

       <filter>
               <filter-name>wicket.yyy</filter-name>


<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
               <init-param>
                       <param-name>applicationClassName</param-name>
<param-value>stop.web.StopApplication</param-value>
               </init-param>
       </filter>

       <filter-mapping>
                <filter-name>wicket.yyy</filter-name>
                <url-pattern>/*</url-pattern>
       </filter-mapping>

</web-app>

Thanks.
--
View this message in context:
http://www.nabble.com/LazyInitializationException-hibernate-wicket-tp20169637p20169637.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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




--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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

Reply via email to