Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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
 
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic