If you extend AbstractTransactionalDataSourceSpringContextTests, it
should solve your LIE problems.

Matt

On 11/30/06, thinkboy <[EMAIL PROTECTED]> wrote:

i solved my problem by add interception in action-servlet.xml .
it works very fine in deployment to tomcat.

however, I got the LazyInitializationException when I run testcases for
xxControllerTest
how can I apply openSessionInViewInterceptor to my spring mvc Controller
testcase ?

~pls advise

===setting===
        <bean id="openSessionInViewInterceptor"

class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
                <property name="sessionFactory">
                        <ref bean="sessionFactory" />
                </property>
        </bean>


        <bean id="urlMapping"
                
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
                <property name="interceptors">
                        <list>
                                <ref bean="openSessionInViewInterceptor" />
                        </list>
                </property>
                ...
                ...




thinkboy wrote:
>
> I managed to find the OpenSessionInViewInterceptor  offered by
> SpringFramework
>
> I think I can solved my problem. sorry to trouble u friends :-D
>
>
> On 2006-11-30 11:15:07 +0800, Man-Chi Leung
> <[EMAIL PROTECTED]> said:
>
>> hi
>>
>> in mvc controller , I am trying to do a call to manager and execute dao
>> for getX() which returns a parent object as a model.
>> but when I try to read Parent's child object(which is lazily
>> initialized)  , hibernate will throw a LazyInitializationException
>>
>> after some reading, I understand that I need "Open Session in View
>> pattern" to extend hibernate's session to a single http request.
>>
>> may I know how to do it ?
>>
>> sorry for the trouble..
>>
>> ~thinkboy.
>>
>> ==Log===
>>     [junit] [platform] ERROR [main]
>> LazyInitializationException.<init>(19) | could not initialize proxy -
>> the owning Session was closed
>>     [junit] org.hibernate.LazyInitializationException: could not
>> initialize proxy - the owning Session was closed
>>     [junit]     at
>> 
org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:60)
>
>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

--
View this message in context: 
http://www.nabble.com/how-to-apply-the-Open-Session-in-View-pattern-in-appfuse--tf2729351s2369.html#a7614990
Sent from the AppFuse - User mailing list archive at Nabble.com.

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




--
http://raibledesigns.com

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

Reply via email to