Hi, I'm encountering a LazyInitializationException in my web tests. This
error is encountered when trying to get aggregated collections within an
FormAction class:

For example, I have a an ArrayList field named fields in a POJO named
Screen:
assertNotNull(bean.getScreen().getFields()) passes
but trying to iterate over the collection, or get an item (e.g.
bean.getScreen().getFields().get(0) - i get a LazyInitializationException.

Getting basic attributes (Strings, Integers, etc.) works just fine.

 I don't get the Exception when I execute the same code in its container
(which I think comes down to the work done by OpenSessionInViewFilter). I'm
trying to work out if other people have had the same issue? Whether there is
an easy way around this. I Googled the issue and came up with this old
Struts1 issue: http://issues.appfuse.org/browse/APF-58.

I need to keep the session open for the lifecycle of the test: this looks
like it might help:
http://www.thearcmind.com/confluence/display/RandomThoughts/Hibernate_Spring+OpenSessionInViewFilter+simulation+in+a+JUnit+test

Any thoughts or ideas would be really helpful!
-- 
View this message in context: 
http://www.nabble.com/LazyInitializationException-and-JSF-web-JUnit-tests-tf3641426s2369.html#a10169863
Sent from the AppFuse - User mailing list archive at Nabble.com.

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

Reply via email to