• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt regarding EJBMetaData Vs Reflection API

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the EJB programming restrictions is that EJB should not use Java Reflection API. Because of this, you got getEJBMetaData method in the remote home interface to interrogate the bean and know about it.

But in local home interface getEJBMetaData method does not exist. As per HFEJB on page 148, you can use java reflection to learn about the bean in case of local objects.

Whether it is a local or remote object, it is EJB only. Why can't the EJB programming restriction of "Reflection API should not be used" apply to the local objects?

Can anyone clarfiy..
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is impossible to use the Reflection API on an object that is 'remote'. To use reflection, we should be able to instantiate a class, using Class.forName(...), and only then we can query information about the class. An EJB that has remote interface may reside on a separate JVM or even physically different machine. It is not (yet) possible to instance an class in a different JVM using Java Reflection API.

It is not that Reflection should not be used on EJBs, but, Reflection cannot be used on remote EJBs/Objects. Its a limitation of the Reflection API.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With the Remote clients,you are actually working on the stub, not with the real object.If you use the reflection API for remote clients then you are interrogating the stub not the real object(EJB instance).So you need to use an EJBMetaData object to interrogate about the remote object.

With local clients both the client and EJB instance are in the same heap, so you will be actually working with EJBInstance not with 'remote object'.
Hence the need of an EJBMetaData object is not required.Hope this clarifies you.Letme know if you need further clarification.Cheers...
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic