GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  EJB
Go To First  |  Previous Question  |  Next Question 
 EJB  |  Question 60 of 175    Print  
Why are ejbActivate() and ejb Passivate() included for stateless session bean even though they are never required as it is nonconversational bean
To have a consistent interface, so that there is no different interface that you need to implement for Stateful Session Bean and Stateless Session Bean. Both Stateless and Stateful Session Bean implement javax.ejb.SessionBean and this would not be possible if stateless session bean is to remove ejbActivate and ejbPassivate from the interface. You could argue that the two (stateful and stateless) are so different that they should have their own interface but Sun did not think so. They made both session beans implement the same interface and provided deployment descriptor to denote which one is it that you are deploying.


  
Total Answers and Comments: 1 Last Update: July 20, 2005   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 20, 2005 22:10:32   #1  
Ginni        

RE: Why are ejbActivate() and ejb Passivate() included for stateless session bean even though they are n...
The simple reason is to manage your resources. For eg. if you use/open any third party resource on ejbActivate, you need to make sure ejbPassivate close the connection/ release the use of resource regardless of stateful session or stateless session.
 
Is this answer useful? Yes | No

 Related Questions

Answer posted by Mohan on 2005-05-20 08:44:39: SessionBeans typically are used to represent a client they are of two typse  Stateful Session Beans : they maintain conversational state between 
Latest Answer : Session bean is encapsulates the business logic. and carry out the task for behalf of the client. It have two types.one is stateful session bean. this is maintain the convesional state.another one is stateless session bean. donot maintain the conversional.state. ...

Answer posted by Mohan on 2005-05-20 08:45:36: Stateful session beans have the passivated and Active state which the Stateless bean does not have. 
Latest Answer : Stateful session beans follow the instance passivation techniqueStateless session beans follow the instance pooling technique.ejbActivate() and ejbPassivate() methods are not called in Stateless session beansI ...

Latest Answer : 1. doesnot exsist 2. exsists 3. passivate  invoke ejbcreate() set the sessioncontext() call create()  if the session idle call ejbPassivate() to get back to session call ejbActivate()  to end the ...

Latest Answer : 1. dose not exsist 2. exsist  to start the session set the sessionContext() call create()  to end session call remove ...

Answered by Jey on 2005-05-08 19:41:22: Session bean callback methods differ whether it is Stateless or stateful Session bean. Here they are.  Stateless Session Bean 1. setSessionContext() 2. 
Latest Answer : Please note down that ejbCreate() is not a method of Session Bean, for reference see the link http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/ejb/SessionBean . html ...

Latest Answer : I'll  take a best exmaple to explain.Statefull sessionbean : ATM operationStateless Session Bean : Credit card Once we log into the ATM by entering PIN number. We can do multiple transacations like Balance enquiry, Withdrawl, ministatement..etc... ...

Answered by Jey on 2005-05-08 12:47:06: Entity bean represents the real data which is stored in the persistent storage like Database or file system. For example, There is a table in Database called Credit_card. 
Latest Answer : entity bean are used to represent state of unique entity.for example. each employee have unique ID . ...

Answered by Jey on 2005-05-08 11:32:16: CMP means Container Managed Persistence. When we write CMP bean , we dont need to write any JDBC code to connect to Database. The container will take care of connection 
Latest Answer : CMP means Container Managed Persistence. In case of CMP bean , developers dont need to write any JDBC code to connect to Database. The container will take care of connection our enitty beans fields with database. The Container manages the persistence ...

Latest Answer : The following steps describe the life cycle of an entity bean instance  An entity bean instances life starts when the container creates the instance using newInstance and then initialises it using setEntityContext.  The instance enters ...

Answered by Jey Ramasamy on 2005-05-08 19:51:04: 1. setEntityContext() 2. ejbCreate() 3. ejbPostCreate() 4. ejbActivate() 5. ejbPassivate() 6. ejbRemove() 7. unsetEntityContext() 
Latest Answer :  setEntityContext(EntityContext) unsetEntityContext() ejbLoad() ejbStore() ejbActivate() ejbPassivate() ejbRemove() ...


 Sponsored Links

 
Related Articles

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

JSP Implicit and Session Objects

JSP Implicit and Session Objects In this JPS tutorial you will learn how to program using JSP JSP expressions and Implicit Objects JSP Session Object methods of session object getAttribute String name getAttributeNames and isNew mosgoogle JSP expressions If a programmer wants to insert data into an
 

HR Interview - HR Interview Mistakes You Will Want To Avoid

HR Interview Mistakes You Will Want To Avoid The job interview can be a stressful process This is especially true for those who are going after a competitive position Your nonverbal communication combined with the answers you give during the interview will determine if you are hired mosgoogle While
 

HR Interview - Behavioral HR Interviews

Behavioral HR Interviews As the name implies a behavioral interview is an interview that is held by a human resources department to determine if an applicant has the behaviors that are appropriate for a job The company must know how an applicant will behave in a certain situations mosgoogle The logi
 

HR Interview - How To Prepare For Your HR Interview

How To Prepare For Your HR Interview Before you begin thinking about how you are going to dress for the interview it is important to do your research first You should learn everything you can about the company you wish to work for When you have detailed information about your employer you will conve
 

HR Interview - Telephone Interview Etiquette

Telephone Interview Etiquette When you conduct a telephone interview for a job it is important to show the proper etiquette Not only is it important it is critical is you wish to be hired by the company There are a number of things you will want to do and other things should never be done mosgoogle
 

HR Interview - How To Succeed At HR Interviews

How To Succeed At HR Interviews There are a number of things you will need to do in order to make sure you pass the interview process Your appearance is something that you will want to pay close attention to Even if you feel that your appearance shouldn t be a factor in whether or not you re highere
 

HR Interview - Do's and Dont's in a HR Interview

Do s and Dont s in a HR Interview There are a number of things that you will want to avoid during the HR interview process While some of these things are directed at the interviewer the other things are directed at the applicant If interviewers fail to follow the proper procedures throughout the int
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape