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

> So can what I am trying to do here be done or am I being abusive of EJB?

I think you're being abusive of the Java type system :-)

For example:

> public interface Foo {
>   public String getName() throws java.rmi.RemoteException;
>   public Long getID() throws java.rmi.RemoteException;
> }
> import org.foo.Foo;
> public interface FooLocal extends EJBLocalObject, Foo {}

is probably not going to work as Foo only contains methods that throw
RemoteExceptions.

I understand that it's tempting to try to reuse as much as possible when you
have methods that you want to be both local and remote, but this is not the
right way to do it (see http://beust.com/cedric/smli_tr-94-29.pdf for more
details).  You *want* these methods to be different, trust me.

The solution would be more along tools, such as EJBGen, which lets you
specify:

/**
  * @remote-method
  * @local-method
  */
  public void doSomething() {
  }

and will generate the interfaces with the right signatures.

The Java type system is here to help you both on a syntactic standpoint and
also on a semantic one, so you can clearly see what methods are remote when
you read your code.  Squelching exceptions in the local case will only bring
you trouble in the long run.

> One of my questions is whether I can deploy this bean as both a local and
> remote bean.

Yes, no problem with that, but you need to expose two distinct interfaces:
one local and one remote.

As a sidenote, I believe that having a bean exposing both interfaces is a
rare case, and even more rare would be exposing the *same* method locally
and remotely.  I would be definitely interested in hearing why you think you
need that.

> And then, once that's done, how do I access it locally vs.
> remotely from client code (hmmm, seems to be a sticky point)?

Remote client invokes stateless session bean (remotely) which in turn looks
up the local home of an Entity bean and passes value objects around.

> I hesitate to ask this question: Any recommendations of an AppServer that
> can at least get me close to the kinds of things I'm trying to
> do;

I would suggest you download the Weblogic 6.1 beta version from our Web
site.  After that, you are very welcome to come and bug us on our newsgroups
:-)

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