Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Using interface for both component and bean

Posts: 5
  • Mark post as helpful
  • send pies
  • 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?

Author & Gold Digger
Posts: 7617
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • 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
  • 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{

It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic