Thanks a lot for your replies, truly.

With the ideas that all have contributed i write a LDM that store a object
that is recovered in iterator and also a id for this object (to recover to
the database after).

I think this will be useful for people who start using Dataview,and are
somewhat confused with the operation. 

public class DetachableContactModel extends LoadableDetachableModel
{
 private long id;

 public DetachableContactModel(Contact c)
    {        
        super(c); //wraps object in model (that is transient internally and
is deleted when method detach fires)
        this.id = c.getId();
        //this is not a transient member, that store de id of the object for
get from the database after
    }

  protected Object load()
    {

        Object ret;
        ret=this.getObject();

        if(ret == null)
          { 
           //If user click remove link for one row, internal transient
object is null and should get load object  from data layer
           return getContactsDB().get(id); }
        else
           {
             //If program execute this, means that dataview is painting rows
and render process of page not ends yet  
             return this.getObject(); }
        
    }

}

If you use a AjaxLink in a dataview row that gets the modelobject
IDataProvider not calls iterator method and only is called load method from
LDM, getting the ContactsDB object from database (because this.getObject();
returns null )

And if you use normal link, full page is reloaded and again calls iterator
method, and model for each row (in this case return getContactsDB().get(id);
never be executed), etc...

I think that LDM in conjunction of IDataProvider and DataView are designed
for use in projects that implements persistence data layer such as hibernate
(and this is not mentioned in wicket documentation).

In the small projects not need have necessarily persistence layer, in my
humble opinion... if you write hand made dao o "service layer" for a few
tables or entities you only need a few methods that execute for example
stored procedures that inset, select and update rows in tables.

In this case that is not exists caching the implementation that i seen in
wicket oficial examples and in other more pages result in a lack of
performance because your prehistoric data access layer (handmade recalls) do
not caching nothing!

I hope reviews!


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Perfomance-of-IDataProvider-tp3325777p3329554.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to