Hi,

#iterator() method loads the raw entities (MyClass), later #model()
method wraps an entity in a IModel impl.
By calling "new DetachableMyClassModel(anInstance)" you give the model
a live instance to work with. Until the call to model#detach() this
model will use this live instance and #load() wont be called at all.
After detaching the model it will keep just the primary key and next
#getObject() will call #load().

Check why #detach() is called between #iterator() and #populate().

On Sun, Apr 15, 2012 at 8:32 PM, DanielSantos
<[email protected]> wrote:
> Hi,
>
> I have a SortableDataProvider that loads a list of objects from de database
> with the following code:
> public IModel<MyClass> model(final MyClassarg0) {
>        return new DetachableMyClassModel(arg0);
>    }
>
> The DetachableMyClassModel is a loadabledetachablemodel.
>
> When I want to populate the dataview, for every record, the application
> calls the load method of the DetachableMyClassModel, calling again the
> database to load the MyClass object.
>
> I guess this is not right, since all the records are already loaded by the
> databaprovider iterator(int first, int count).
>
> Any ideas?  (I used the same code as in the repeaters in the wicket
> examples)
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/LoadableDetachableModel-loading-twice-with-dataprovider-tp4559510p4559510.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to