[jboss-user] [EJB 3.0] - Re: How to look up one of the many interfaces that a bean im

ALRubinger do-not-reply at jboss.com
Sat Feb 24 18:52:02 EST 2007


Right...so the proxy object is going to be created by JBoss and will implement all the interfaces you designate.

When your client does a lookup for this object, it's going to get loaded by the classloader, along with all dependencies it has.

So if the definition in the classfile is something like (I'm making up some JBoss classnames for simplicity's sake) "Proxy$1 extends JbossRemoteProxy implements MyRemoteIF", then your client must have MyRemoteIF on its classpath (even though you just want the functionality defined in the superclass Interface1 at compile time, the actual object you're working with at runtime is what's most important here).

So, I propose you do something like the following:

public abstract class MyClassBase {
  | 
  | ... all your business logic defined by Interface1 and Interface2...
  | }

@Remote
  | public interface Interface1{}

@Remote
  | public interface Interface2{}

@Stateless
  | @RemoteBinding(JndiBinding="MyCompany/MySessionBean1/remote")
  | public class MyClass1 extends MyClassBase implements Interface1{}

@Stateless
  | @RemoteBinding(JndiBinding="MyCompany/MySessionBean2/remote")
  | public class MyClass2 extends MyClassBase implements Interface2{}

..this way, you'll have centralized your logic into one base class, and deployed the Stateless Beans separately such that one need not have any knowledge of the other.

S,
ALR

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021779#4021779

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021779



More information about the jboss-user mailing list