Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Home Interface Create method

Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The book says that the create method of home interface can be delcared as,

>>public Advice create() throws CreateException, RemoteException;

As I can see EJBHome does not have any create method. Secondly if EJBHome would have got any create() method, then Advice create() is not a right declaration.

As I did not find any of the linking of this create method in any parent interfaces either EJBHome or EJBObject or for that matter in SessionBean or EnterpriseBean, I opted to call my create as invent. so the method signature became,

public Advice invent() throws CreateException, RemoteException.

the compilation goes smooth, even the verification is going great in RI.

But when I try to deploy this on server, it throws a popup error saying RMI and all kind of exceptions.

Why is this happening, I have made sure that my business method i.e. getAdvice is identical in Component interface as well as in Bean class.

Please explain. [Current state of mind: ]
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the create() method has relation to ejbCreate() method that you would have included in the bean class. As with the other methods (like business methods), at the compile time, you wouldn't face any issues because bean class doesn't implement home or component interface.

I would suggest you go thru the first 5 chapters (so you will get an idea as to why all these methos (all methods starting with ejb and create methods) are needed. Then you can experiment with them.

Good Luck
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is the rule that you should have,
ONE create method in StateLessSessionBean home interface
ONE or MORE create methods in StateFulSesssionBean home interface
ZERO or MORE create methods in Entity Bean home interface.

In EJBHome you will not find create method because the same EJBHome is used for entity bean home interfaces too and Entity Bean home interface no need to have create method.
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic