Presumably the desire is to represent each product type in a separate db
table. There is no reason the shopping cart SFSB cannot hold a
heterogeneous collection of such products. The more interesting question
is where the product objects come from. This usually entails a
persistent collection whose elements reference different types of
objects, e.g.
Catalog contains Items
Item { int itemNbr; int prodId; ProdType prodType; double price; }
where prodId is the primary key of products from various tables and
ProdType is an enumerated tag. You can easily get from prodType to the
correct EJB home, and from prodId to the desired EJB object. Your
shopping cart holds a single collection of Items. The sole requirement
is a uniform product id format, which is standard good practice for
other reasons as well.
There are arguably better variations on this approach that use a Value
Object or ejb 2.0 CMR, but the basic idea's the same. You shouldn't have
to shoehorn logically different entities into a single class or table
because of an artificial requirement that the SFSB collection must be a
homogeneous set of product EBs.
Fred Loney
Spirited Software, Inc.
www.spiritedsw.com
> ----- Original Message -----
> From: "Hunter Hillegas" <[EMAIL PROTECTED]>
> To: "JBoss 2" <[EMAIL PROTECTED]>
> Sent: Tuesday, October 09, 2001 7:38 PM
> Subject: [JBoss-user] EJB Design Question
>
>
> > I have been tasked with creating a J2EE B2C e-commerce application
using
> > EJB2.0...
> >
> > I'm mulling over design possibilities and I have a question about
how I
> > should setup the CMP beans for products w/ the shopping cart bean...
> >
> > Basically the store will carry several different types of items,
namely
> CDs,
> > clothes, and other random items. CDs and clothes have some
distinctly
> > different attributes to describe them (i.e. clothes have sizing and
color
> > attributes, CDs don't, etc...). It seems natural to have a CMP bean
for
> each
> > type of item that will be sold...
> >
> > When it comes to the shopping cart bean though, it feels like having
a
> > different collection for each type of saleable item is bad design...
That
> > means that adding new types of products in the future will require
changes
> > to the cart as well? That seems like a poor design choice...
> >
> > Do I have other options I'm not thinking of?
> >
> > Thanks,
> > hunter
> >
> >
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/jboss-user
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
>
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user