incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Lessard" <simon.lessar...@gmail.com>
Subject Re: dataTable - loading data in a bean constructor
Date Fri, 20 Apr 2007 21:08:26 GMT
Hmmm, you can use a session scoped bean too why my suggestion, you just have
ensure that it stay synchronized with the database. However, a List would
not be the good solution for that. I think you should create your own
implementation of a CollectionModel that would support lazy fetching and
keep in sync with your model.


Regards,

~ Simon

On 4/20/07, Daniel King <danking@nemours.org> wrote:
>
> Simon,
>
>   Thanks for the response.  This is for a shopping cart application with
> a huge number of possible clients.  Also this table has the ability to
> paginate.  The problem with your idea would be that the bean is request
> scope and gets constructed again when the table is paginated.  This
> calls the method to fill the table from the constructor and the PPR
> method.  And if I check to see that it is a PPR method and not load the
> data then it isn't loaded whenever it is within a subview for a tab.
>
> Daniel King, R2D2, C3P0
> Application Engineer
> Web Team
> Nemours
> Office: (904) 288-5643
> Fax:    (904) 288-5758
>
> *** Call me Daniel ***
>
> NOTICE...This electronic transmission is intended only for the person(s)
> named.  It may contain information that is (i) proprietary to the
> sender, and/or (ii) privileged, confidential and/or otherwise exempt
> from disclosure under applicable State and Federal law, including, but
> not limited to, privacy standards imposed pursuant to the federal Health
> Insurance Portability and Accountability Act of 1996 (HIPAA).  Receipt
> by anyone other than the named recipient(s) is not a waiver of any
> applicable privilege.  If you received this confidential communication
> in error, please notify the sender immediately by reply e-mail message
> and permanently delete the original message from your system.
>
>
> -----Original Message-----
> From: Simon Lessard [mailto:simon.lessard.3@gmail.com]
> Sent: Friday, April 20, 2007 3:43 PM
> To: adffaces-user@incubator.apache.org
> Subject: Re: dataTable - loading data in a bean constructor
>
> Hello Daniel,
>
> What prevent you from using an instance variable initially set to null
> and
> load the data in the bean's get method only if the cached value is still
> null? Like:
>
> public class MyBean {
>   private List<Client> loadedClients;
>
>   public List<Client> getClients() {
>     if (loadedClients == null) {
>       loadedClients = loadClients();
>     }
>
>     return loadedClients;
>   }
> }
>
> On 4/20/07, Daniel King <danking@nemours.org> wrote:
> >
> > Currently I am loading a data table's data in the constructor of my
> > bean.  I can check to see when my bean is constructed if it is a
> > postback and if so skip this data load.
> >
> >
> >
> > However I have a situation where I have a subview which has a data
> table
> > that needs data loaded as soon as you hit the page.  This postback
> check
> > will cause the data load to be skipped.
> >
> >
> >
> > Anyone else have a similar problem and solution where they need data
> > loaded as soon as a page loads and not on PPR?
> >
> >
> >
> > Postback check example:
> >
> >
> >
> > public MyBean() {
> >
> > if(!RequestContext.getCurrentInstance().isPostback()) {
> >
> >   // load data
> >
> > }
> >
> > }
> >
> >
> >
> > Thanks,
> >
> > Daniel King, R2D2, C3P0
> >
> > Application Engineer
> >
> > Web Team
> >
> > Nemours
> >
> > Office: (904) 288-5643
> >
> > Fax:    (904) 288-5758
> >
> >
> >
> > *** Call me Daniel ***
> >
> > NOTICE...This electronic transmission is intended only for the
> person(s)
> > named.  It may contain information that is (i) proprietary to the
> > sender, and/or (ii) privileged, confidential and/or otherwise exempt
> > from disclosure under applicable State and Federal law, including, but
> > not limited to, privacy standards imposed pursuant to the federal
> Health
> > Insurance Portability and Accountability Act of 1996 (HIPAA).  Receipt
> > by anyone other than the named recipient(s) is not a waiver of any
> > applicable privilege.  If you received this confidential communication
> > in error, please notify the sender immediately by reply e-mail message
> > and permanently delete the original message from your system.
> >
> >
> >
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message