• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Using interface for both component and bean

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just started reading the Head First EJB book. Sorry if this question already has been asked, but I couldn't find it here.

The design on page 86 (and the brainpower question on page 22) suggest the use of a common interface for both the component interface and the bean.

But the methods in the component interface must throw the RemoteException, where the methods in the bean should not.

How can a single interface be used here?

Geert.
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Geert,

Welcome to Javaranch, a friendly place for Java greenhorns

Please refer to this discussion which handles the same topic.
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just extend from the common interface that contains business methods, not the component interface.

interface CommonIF{
public void verify();
}

public class CreditCardBean extends SessionBean implements CommonIF{

}

public interface CreditCard implements EJBObject, CommonIF{

}
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic