Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » J2EE Interest »

Re: EJB or sql query

Suneet Shah

2003-10-01

Replies:

Hi Stan,

I have not reviewed the oracle sample application, but it would be in
efficient to get a list of orders and then for each order in the list to
call the order item to bean to get the line items. This will incur to many
database hits for my liking. If you want to use EJBs for this task, then
create a stateless session bean where you can run you query and the
construct a VO to pass back to the web tier. You should be able to do this
in 1 to 2 database hits.

The approach described in the sample app would be fine to view the line
items for one order, but not a collection.

Regards,

Suneet Shah
Diamelle Technologies
J2EE Business Objects
www.diamelle.com

----- Original Message -----
From: "Stan Ou" <jou128@(protected)>
To: <J2EE-INTEREST@(protected)>
Sent: Wednesday, October 01, 2003 2:40 PM
Subject: EJB or sql query


> Hi all,
> I'm trying to digest the sample oracle vsm(virtual
> shopping mall) code to get a better understanding of
> J2EE. For those who are not familiar with that sample
> app, the logic is actually quite simple.
>
> One of the functionality is to display the last few
> orders the logged in user has placed along with along
> with each item's description. In the app, it gets a
> reference to the orderEJB, get a collection of orders,
> iterate this collection, for each element in
> collection, get a reference to the orderItems ejb, get
> a collection of items for this order. Then assemble
> these in a VO and pass it back to the web tier. Quite
> some work. Now my question is wouldn't it be more
> efficient to run a sql like this (or for anything
> where I need to join several tables):
>
> select some orderinfo, iteminfo
> from orders join orderItems
> where orderBy = user
> and etc, etc.
>
> Is fine-grained better than coarse-grained, can
> soemone shed some light on this ?
>
> thanks
>
> stan
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
>
>
===========================================================================
> To unsubscribe, send email to listserv@(protected)
body
> of the message "signoff J2EE-INTEREST". For general help, send email to
> listserv@(protected)".

===========================================================================
To unsubscribe, send email to listserv@(protected)
of the message "signoff J2EE-INTEREST". For general help, send email to
listserv@(protected)".


©2008 junlu.com - Jax Systems, LLC, U.S.A.