Win a copy of Spark in Action this week in the Open Source Projects 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 ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Question about the Session/Entity Context interfaces

 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why the EJB designers have defined only the following methods in the SessionContext/EntityContext interface?

EJBObject getEJBObject
EJBLocalObject getEJBLocalObject

and those methods haven't been declared in the super interface EJBContext, where all other inherited methods have been declared (except from Object getPrimaryKey in the EntityContext interface, which is obvious, as session beans can't have a primary key)
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm totally guessing here, but a you can only get a reference to the EJBObject after the SessionContext has been set by the container. Since we are able to access the EJBContext at runtime, putting EJBObject getEJBObject in the SessionContext interface disallows the client to call get a reference to the EJBObject before the SessionContext has been set.

EntityContext must also define those methods since it extends EJBContext.

Any suggestion on my logic?
[ August 08, 2004: Message edited by: Ryan Wong ]
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moreover, it wouldn't make sense for MessageDrivenContext (which extends from EJBContext) to expose getEJB(Local)Object methods as message-driven beans do not provide any client view.
 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ryan Wong:
I'm totally guessing here, but a you can only get a reference to the EJBObject after the SessionContext has been set by the container. Since we are able to access the EJBContext at runtime, putting EJBObject getEJBObject in the SessionContext interface disallows the client to call get a reference to the EJBObject before the SessionContext has been set.

EntityContext must also define those methods since it extends EJBContext.

Any suggestion on my logic?

[ August 08, 2004: Message edited by: Ryan Wong ]



Well, I was more thinking of the opposite way. To declare the EJBObject-related methods in the EJBContext interface.
 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Marco Tedone:


Well, I was more thinking of the opposite way. To declare the EJBObject-related methods in the EJBContext interface. And following what Valentin said about Message-driven beans and EJB[Local] interfaces, the same would be true for EJB[Local]Object. If the architects decided to put EJBHome related methods in the EJBContext, they could have put also EJBObject related methods. Don't you think?

 
    Bookmark Topic Watch Topic
  • New Topic