Igor,

I'm not using a loadable detachable model because I was hoping to get the
list of foos directly from the Bar object, as opposed to having a dedicated
dao method to get the list of foos, which seems to defeat the benefit of
using JPA's object chaining. To answer your question, here's my
implementation of dataprovider#model():

        public IModel model(Object object)
        {
                return new Model((Serializable) object);
        }

Of course, it's very possible I'm missing a fundamental point about loadable
detachable models...



igor.vaynberg wrote:
> 
> what is your dataprovider#model() look like? are you using a loadable
> detachable model?
> 
> -igor
> 
> On Mon, Nov 3, 2008 at 11:04 AM, 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]
>>
>>
> 
> ---------------------------------------------------------------------
> 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-tp19721199p20310904.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]

Reply via email to