> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]]On Behalf Of Sacha Labourey

> If I well understand your point :
>         - specify in Bill.create(...) the paiement process type as a
> parameter (an enum class for example)
>         - in my BillBean.ejbCreate, also create a BillPaiementProcess
> EJB object of the right class (determined thanks to the parameter)

Yes.

>         - from my client code get my BillPaiementProcess EJB object
> from the newly created Bill
>         - adjust properties and call method, from the client, on the
> BillPaiementProcess EJB created by and from the Bill EJB.

I'm not sure what you're saying here.  You are receiving an object that implements
a specific interface (your bean) which has been declared in your Home interface.
If you intend to cast the returned object to a different interface, then I would
argue that something is wrong with your design.

The solution I am offering is half-cooked in the sense that while you can specify
a dynamic type as a parameter to your ejbCreate(), the returned object has to
conform to a certain interface, regarding of the different implementations it
might be an instance of.

If you need radically different operations to be performed on the returned object,
you should probably create as many homes as needed, a design that I would
recommend for several reasons:

- insulate the several implementations in distinct classes (and different beans)
- avoid an awkward if/else/else/else based on dynamic typing, which is usually the
symptom of an ill-formed design

I might not have completely understood what you're trying to do, though...

--
Cedric

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to