[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Listing Behavior
Two thoughts on this which both come from experience. Note, these thoughts
dont entirely answer your question.
First, returning a list of entity beans can be very expensive, and usually
unnecessary overhead. With a small list this may not be such a big deal, but
say you were talking about 100+ items returned. You'll definately run into
performance issues there. You'll probably force yourself to have to start
tweaking the caching settings for your EJB's at that point too. Better to
return a list which contains primary keys to find your entity beans if you
happen to need them later. For instance, your end result in needing the list
is to display with links to detailed views of the individual items. When the
client needs to access an individual from the list, you can then use the PK
to look up the entity bean. On a side note, if your reason for showing the
list is so items in it may be acted upon (edited) directly from the listing
page, and your list is small, entity beans my not be a terrible idea.
Secondly, a handy method for handling lists within a JSP client is to use
Collections. There may be better ideas, but this one I know works really
well. With using a collection in a JSP, you can easily write a generic jsp
tag that can process the collection for output and eliminate any code for
iterating over it in the JSP.
*plink**plink*
Matthew
----- Original Message -----
From: "Kevin O'Neill Stoll" <kevinostoll@yahoo.com>
To: <ajug-members@www.ajug.org>
Sent: Wednesday, March 27, 2002 6:32 PM
Subject: Listing Behavior
> Hey all,
>
> I have some questions regarding listing behaviors. Let's say I would like
> to return a list of products from the database for an html/servlet/jsp
> client to display. There is a method in a session bean that returns the
> results for this listing behavior.
>
> !st Q: If the list that is returned spans multiple entity beans, How
> should I go about getting this list back? Work with the Entity Beans or
> just connection directly to the tables with a complex query?
>
> 2nd Q: Once I have the list built through either of the above mentioned
> methods, What, in your experience, has been the best way to return this
> data to the client? XML string, Collection, array, or ... ?
>
>
> I have been reading O'Reilly's Enterprise EJB and the author uses a
> stateful session bean which has a method that returns a delimited string
> array by way of a complex sql statement to access the data.
>
> Anyway, I'm interested in 'hearing' what your real-life experience has
> been with this, what worked best and why.
>
>
> Thanks a bunch in advance,
>
> Kevin Stoll
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Movies - coverage of the 74th Academy Awards®
> http://movies.yahoo.com/
>
>
>