• 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 ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Using interface for both component and bean

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

Geert.
 
Author & Gold Digger
Posts: 7617
6
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{

}
 
Maybe he went home and went to bed. And took this tiny ad with him:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic