Re: Why can't a bean class implement either Remote or Home Interface
Tuesday, July 16, 2002 06:00 PM
I believe that bean class can implement the Remote interface, but it is discouraged. The reason is that if you implement this interface, you can pass yourself as an argument to another bean directly, and you will not receive any compile-time complaints. This violates the spirit of EJBs though, as all access is supposed to go through the service layer provided by the appserver implementation.
As for the home interface... you could implement it, but what would be the point? You don't have to implement this interface at all, you just provide it to the appserver and it takes care of generating an implementation which is then stored in JNDI for you ( I think... it's been awhile since I've written these out by hand ). You'll have to look up this appserver implementation if you want to use a remote object, calling the a create method directly in your bean implementation will just result in an object created in memory in the same JVM, which defeats the point.
Hope this helps.