• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unsetEntityContext(...)

 
Shreyas Reddy
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SessionBean interface has setSessionContect(...)
MessageDrivenBean has setMessageDrivenContext(...)
EntityBean has setEntityContext(...) and unsetEntityContext(...)

Why does only entitybean have the callback method to unset its entitycontext? WHy not sessionbean and messagedrivenbean?
thx,
 
Vaithiya Sundaram
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is because when you call remove method on Entity Bean it is not ACTUALLY removing the bean instance, it is removing bean representation of entity data. The bean instance still will be in pooled state. When container removing the bean instance the unsetEntityContext() is called to free any resources that are held by the instance.
 
Paulo Asterio Nunes
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shreyas,


According with EJB Especification unsetEntityContext is to free any resources that are held by instance resources whose had been allocated by setEntityContext method.

I could'nt see any explanation of this definition in spec and I will search once more.

Regards,

Paulo Nunes
Brazil
MCP OCP IBM285 SCJP 1.4 SCWCD 1.4 SCBCD 1.3
 
Paulo Asterio Nunes
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sundaram,

Now its make sense !

Thank you .!

Paulo Nunes
Brazil
MCP OCP IBM285 SCJP 1.4 SCWCD 1.4 SCBCD 1.3
 
Shreyas Reddy
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just for clarification...
for session and message driven beans resources are released in ejbRemove()
But for entity beans, ejbRemove is used to actually remove the entity in the persistant store and unsetEntityCtx is used to release resources- when the bean is removed from the pool. Did I get it right?
Please explain if not so...
thx
 
Paulo Asterio Nunes
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YES you do ! ! !


count with me !


Regards,

Paulo Nunes
Brazil
MCP OCP IBM285 SCJP 1.4 SCWCD 1.4 SCBCD 1.3
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic