James, thanks for your reply. I've checked that my OpenEntityManagerInViewFilter precedes the Wicket filter. And my debug log indeed shows that it seems to be opening and closing the entity manager before and after the wicket filter runs. I'm hoping to avoid the type of query you suggest, but I'm realizing I may need to resort to it.
Julian msc65jap wrote: > > Firstly, your code is rather strange. That getFoos() method is not part of > the List Interface API. > > Two possible solutions: > > The filter chain maybe incorrect in your web.xml. Your > OpenEntityManagerInViewFilter might not be preceding the Wicket filter. > Check that it does precede it. > > If you have a deadline then I recommend having one query that retrieving > both foos and bars in one hit. I've never touched JPQL but in Hibernate > Query Language (HQL), one could write this: > > "select f from Foo f inner join fetch f.boo b where b.id = :id" > > Good luck, > James. > > On Mon, Nov 3, 2008 at 7:04 PM, JulianS <[EMAIL PROTECTED]> wrote: > >> >> I am experiencing exactly the problem outlined in the subject of this >> post, >> and I would really appreciate any help I can get, as I am under a >> deadline. >> It's the first time I'm using Wicket with JPA, and I just don't >> understand >> why this isn't working. >> >> I have a Wicket dataprovider that looks like this (I've simplified it a >> bit): >> >> public abstract class FooDataProvider extends SortableDataProvider >> { >> private static final long serialVersionUID = 1L; >> >> @SpringBean >> protected MyAPI myApi; >> >> public FooDataProvider() >> { >> super(); >> // Injects the spring bean >> InjectorHolder.getInjector().inject(this); >> } >> >> public Iterator iterator(final int first, final int count) >> { >> List<Bar> bars = myApi.getBars(); >> List<Foo> foos = bars.getFoos(); >> return foos.iterator(); >> } >> } >> >> I am using a very standard Spring JPA setup, and my web.xml includes a >> OpenEntityManagerInViewFilter. The spring bean is being injected >> properly, >> and my list of Bar is returned correctly. But I get a >> LazyInitializationException no matter what I try. What am I doing wrong? >> >> Many thanks, >> Julian >> >> -- >> View this message in context: >> http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20308559.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] >> >> > > -- View this message in context: http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20310970.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]