why all the complexity of ldm inside idataprovider, why not just:

class mydataprovider implements idataprovider {
  private long applicantid;
  private transient applicant applicant;
  private applicant getapplicant() { if (applicant==null) {
applicant=dao.get(applicantid); }}
  private iterator(..) {
         return getapplicant().getapplications();
  }
  private size() { return getapplicant().getapplications().size(); }
  private void detach() { applicant=null; }
}

-igor

On Mon, Apr 19, 2010 at 7:42 AM, Steve Hiller <sh...@bellsouth.net> wrote:
> Hi All,
>
> I need help with a Wicket architecture design issue that I am having.
>
> In previous Wicket applications, I have used the LoadableDetachableModel in 2 
> separate ways:
>
> 1) In the constructor of a WebPage, an LDM is instantiated and then used as 
> the model
> for a component such as a ListView. This is staight out of "Wicket In Action" 
> Chapter 4
> on LDMs.
>
> 2) As the model for a SortableDataProvider to be used with a DataView 
> component.
> I have more or less used the WicketStuff SortingPage example as a guide. That 
> is,
> the SortableDataProvider uses an LDM to supply its own backing data.
>
> For a new Wicket application, I have a WebPage that will have the following 
> aspects:
>
> 1) A sortable grid based on the DataView component.
> 2) The data behind the grid is a collection of "Job Application" objects that 
> is owned by an "Applicant" object.
> 3) A link somewhere else on the page will cause a new Job Application object 
> to be added to the Applicant's list.
> 4) Adding the Job Application object will cause a new record to be written to 
> the underlying database.
>
> Hibernate will be used as the persistence framework.
>
> So here is my issue:
> For this new application, is the correct approach to:
>
> 1) create an LDM in the WebPage's constructor that loads the Applicant object,
> 2) pass the Applicant object's collection of Job Applications objects to the 
> SortableDataProvider
>   that is used with the DataView component?
>
> Or should the SortableDataProvider use its own LDM that is separate from the 
> one used on the WebPage?
>
> Thanks in advance,
> Steve
>

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

Reply via email to