• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

unsetEntityContext(...)

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
What do you have to say for yourself? Hmmm? Anything? And you call yourself a tiny ad.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic