Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about the Session/Entity Context interfaces

 
alzamabar
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)
 
Dan T
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 ]
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic