가장 많이 묻는 면접 질문과 답변 & 온라인 테스트
면접 준비, 온라인 테스트, 튜토리얼, 라이브 연습을 위한 학습 플랫폼

집중 학습 경로, 모의고사, 면접 준비 콘텐츠로 실력을 키우세요.

WithoutBook은 주제별 면접 질문, 온라인 연습 테스트, 튜토리얼, 비교 가이드를 하나의 반응형 학습 공간으로 제공합니다.

Prepare Interview

EJB 면접 질문과 답변

Question: Explain the life cycle method of EJB?
Answer:

Life Cycle of Entity Bean:

  • First stage is Does Not Exist Stage then Container creates the instance of EJB and call SetEntityContext() method which will set all entity context to bean and now it will become available on pool, to get a particular identity of an EJB object it has to move from Pooled stage to ready stage which is done by calling the create() method which in turns call ejbCreate() and ejbPostCreate() method.
  • There is another way by which directly entity bean can move to pooled stage to ready stage that's is call ejbActivate() method. Now we are ready to invoke the business method of entity bean .After completion of business method if we want to move again in pooled stage from ready stage we can call remove() method which in turns call ejbRemove() or directly call ejbPassivate() method.
  • At the end container remove the instance of EJBfrom pool and call unSetEntityContext().
Life Cycle of Stateful Session Bean:
  • Stateful session beans life cycle starts when client call create() method.The container create the instance of session bean and call setSessionContext() and ejbCreate() method.
  • Now the stateful session bean is ready to serve the client request after serving the request if it is not used after a long time container can move this bean to passive stage by calling the ejbPassivate() method.similarly when bean is in passive stage and client invoke the business method the container call ejbActivate() method to move bean from passive stage to active or ready stage.
  • At the end of life cycle client call remove() method and container will call ejbRemove() method and bean is ready for garbage collection.
Life Cycle of Stateless session bean:
  • Stateless session bean has short life cycle it can have two stage does not exist and ready stage. ejb container create the instance of stateless session bean and call setSessionContext() and ejbCreate() method.Now the bean is ready to invoke business method on this.it will not maintain the state so remove () method is been called after completion of business method which in turns call ejbRemove() and now its ready for garbage collection.
Life cycle of Message Driven bean:
  • MDBs have same life cycle like stateless session bean. setMessageDrivenContext() method and ejbCreate() method is called by container to create the instance of MDB.now its ready to receive message and at the end of lifecycle client will call remove() method which in turns call ejbRemove() and now its ready for garbage collection.

복습용 저장

이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.

내 학습 라이브러리 열기
도움이 되었나요? 아니요

Most helpful rated by users:

Copyright © 2026, WithoutBook.