Tim Pedone wrote:
>
> Hello,
>
> We've started creating an object model that we are going to implement using EJB.  
>I've come across a fundamental design issue that I'm not sure how to solve.  We have 
>two beans:  ControlParamBean and ActivityBean (along with their associated interfaces 
>ControlParam and Activity).  ControlParam has a method called setActivty() that takes 
>an Activity as an argument.  This method will be called from the client.  Activity 
>has a method called addControlParam() that takes a ControlParam argument.  The body 
>of ActivityBean.addControlParam() looks like this:
>
> aControlParam.setActivity(this);
>
> Of course the problem is that  setActivity() takes an Activity and "this" is an 
>ActivityBean.  I can't cast it because ActivityBean does not truly implement 
>Activity.  Since the client knows nothing of the ActivityBean class, I can't change 
>setActivity() to take an ActivityBean either.  How should this be handled?

What about:

  Acvitity self = 
(Activity)javax.rmi.PortableRemoteObject.narrow(_context.getEJBObject());
  aControlParam.setActivity(self);

or:

  Acvitity self = (Activity)_context.getEJBObject();
  aControlParam.setActivity(self);

if your server doesn't support the standard narrowing mechanism.
________________________________________________________________________________

Evan Ireland              Sybase EA Server Engineering       [EMAIL PROTECTED]
                            Wellington - New Zealand              +64 4 934-5856

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