Win a copy of liveProject: Build an ML Recommender System this week in the Artificial Intelligence and Machine Learning 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

ejb lifecycle question

 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please see a state diagram for entity bean from http://www.kevinboone.com/ejb-lifecycles.html .
I have some questions about it.
1. are the beans in state of the Passive not maped to any item of database?
2. what situations let container build a new bean in state of the Passive?
 
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Timber,

Originally posted by Timber Lee:
1. are the beans in state of the Passive not maped to any item of database?


Shouldn't for entity EJBs the state be called "pooled" instead of "passive"?
The Entity Bean's Instance Lifecycle consists of the states:
- does not exist
- pooled
- ready
The Client's View of an Entity Beans's Lifecycle consits of the states:
- Does not exist and not referenced
- Does not exist and referenced
- Exists and not referenced
- Exists and referenced.
As far as I know in the pooled (not "passive") state you find two kinds of Entity Beans:
a. Instance still without identity (only newInstance() and setEntityContext() have been done).
- - Usable for any find...(), not for ejbActivate().
- - As long as they have no ID they are not mapped to a database/EIS entity.
b. Instance got an identity (primary key) by find...() and
- - thereby has been mapped to a database/EIS entity, and
- - member variables
- - - have been populated from database/EIS before ejbPassivate(),
- - - - i.e.have been mapped to column field values, _OR_
- - - have not yet been populated by a database load
- - - - (never have bean in ready state for the current pk),
- - - - i.e have not been mapped to column field values yet.
- - Instance is reusable for
- - - ejbActivate() (from swap file)
- - - - if it had been swapped out on passivate(), _OR_
- - - any other find() resulting in an other primary key and identity.
- - - - Member variables become invalid, and
- - - - are no longer mapped to column field values.

Originally posted by Timber Lee:
2. what situations let container build a new bean in state of the Passive?


In the state of pooled (not "passive") never a new entity bean is (or needs to be) created for this database/EIS entity, only from state "does not exist", or again after having freed that resource by unsetEntityContext().
Literature: R. Adatia et al.: "Professional EJB", page 126 .. 128.
Hope I am right,
Thomas.
 
I need a new interior decorator. This tiny ad just painted every room in my house purple.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic