>
> Better use Bulk accessor...
>

I agree.

> 1. Make a separate Data Class having all the fields with public access
>     & make it Serializable bcoz It's tough to pass something around 30
>     arguments to any other bean.
>
> 2. Don't provide any constructor, accessor & mutator. This seems to be
>     far off than Java Coding Standard but believe me, when performance
>     matters, then a method call is more costly than simply accessing the
>     instance variable.
>

I agree that having a data class is a good idea, I'm not sure I like the
idea of making all the fields public. I would use  accessor methods and a
constructor. You can make the accessors final - considering what happens in
your EJB app I would be very surprised if this were slower than a direct
access. Using this method, you can put (very limited) business intelligence
inside your data class (such as checking that a field value is in the right
range).

> 3. In JSP, make the data object, set the instance variables to
> valid values
> &
>     then pass it to bean.Bean will act on the data & update the
> DB. Results
>     of that can be updated in the data object & then return this
> object back
> to
>     JSP for display. Don't unset the previous data. That can be useful
> later.
>     Here u need to take care of valid values bcoz u are not
> initializing the
>
>     variables when u are constructing the object.
>

Depending on the size of your application, I would consider using separate
data classes for communication between session beans/entity beans and
servlets/session beans. Using the same class is simpler, but IMO exposes
more of your data model to the presentation layer.

> 4. U need not package this class with the jar. Simply place it in
> the Server
> 's
>     Classes directory.
>

This is probably your only option if your using WLS, other containers are
hopefully better in this respect. The problem with this approach is that
your jar no longer contains a complete component, meaning that it cannot be
independently distributed, (hot) deployed etc.

____________________________________________________________________
Stefan Tilkov -- stefan(dot)tilkov(at)innoq(dot)com -- www.innoQ.com


> I hope this can be the best solution....
>
> Any other better soltion?????
>
> -Davender Chhabra
>
>
> > -----Original Message-----
> > From: Mohit Jain [SMTP:[EMAIL PROTECTED]]
> > Sent: Monday, August 07, 2000 9:20 PM
> > To:   [EMAIL PROTECTED]
> > Subject:      Design: multi-argument EB create method
> >
> > Hi Gurus,
> >
> > If I have a EB with say 15 persistent fields, how do I pass the
> data from
> > my SessionBean to it?
> >
> > 1. pass all the fields as individual arguments on the create method call
> > >> public BeanKey ejbCreate(String arg1, String arg2, String arg3..... ,
> > String arg15) throws CreateException
> >
> > 2. pass the fields as a String array
> > >> public BeanKey ejbCreate(String[ ] args) throws CreateException
> >
> > 3. use a "Bulk accessor" which would encapsulate all the Data elements:
> > >> public class BeanData
> > >> {
> > >>   public String arg1;
> > >>   public String arg2;
> > >>   public String arg3;
> > >>   ...
> > >>   public String arg15;
> > >>
> > >>   public BeanData(String arg1, String arg2, String arg3.... , String
> > arg15)
> > >>   {
> > >>        this.arg1 = arg1;
> > >>        ...
> > >>        this.arg15 = arg15;
> > >>   }
> > >>}
> > Then my SessionBean can create a new instance of the BeanData object and
> > pass it accross to the EB.
> > Even if I use the Bulk accessor
> >      a. should I use individual setter accessors to set data or should I
> > pass all the values in the constructor??
> >      b. how should the BeanData object be packaged, should it belong to
> > the
> > EntityBean component jar file or should it be placed on the
> > application-server's serverclasses directory?
> >      c. If the same data is coming all the way from the JSP, should the
> > JSP
> > also pass the data using the BeanData object to the SessionBean?
> >
> > Anyone has any recommendations?
> > Regards
> > Mohit
> >
> >
> ==========================================================================
> > =
> > 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".
>
> ==================================================================
> =========
> 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".
>
>

===========================================================================
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