Hi Karen,
The solution I use is to "simulate" the OSIV filter in my TestCases. I
write a base test class that can open/close an hb session and tx, and
then use it in setUp/tearDown, or directly in test methods, like this
:
public void testMe() {
Transaction tx = openSessionAndTransaction();
try {
// do some tests
getSession().load(...);
...
} finally {
tx.commit();
}
}
The base test class implements the methods for opening the session/tx,
binding it to the current thread, and closing it. Used in
setUp/tearDown, you don't even notice it's there, just like the
regular OSIV behavior...
Of course, depending on the type of OSIV you use, you'll have more or
less code to write to implement those methods in your base class. I'm
derivating from Spring's OSIV, and basically migrated the filter's
session/tx demarcation code into my base test class.
HTH
Cheers
Remi
2009/11/4 KR <[email protected]>:
> Hi,
>
>
>
> In my ActionBeans I use lazy loading Hibernate entities that are accessed in
> the JSP view.
>
>
>
> Runtime this session in view pattern work excellent. But it does not work
> during JUnit testing. The session is closed after calling execute on the
> MockRoundtrip, making it impossible to check the results.
>
>
>
> How can I make sure the session of the MockRoundtrip does not end after the
> 'execute' command?
>
>
>
> Kind regards,
>
> Karen
>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users