Top X Ejb Interview Enquiry In Addition To Response Asked Inward Coffee J2ee Interviews
10 EJB Interview Questions too Answer from my collection of interview questions. I direct hold been sharing interview questions on diverse topics similar Singleton interview question, serialization interview question too most lately Spring interview questions. No dubiety these questions are real of import from performing amend inward J2EE too EJB interviews only every bit good they opened upward novel path for learning every bit yous may abide by about concept novel fifty-fifty patch revising your cognition inward EJB. EJB interviews has e'er been tough because its hard to abide by people who has hands on experience on Enterprise Java Beans (EJB) and most of the guys either direct hold worked alone on sample projection too non aware of critical functionalities similar distributed transaction management, container managed persistence too diverse other services which EJB provides. We volition come across about of those inward 10 interview questions on EJB. I direct hold provided sample answers for these EJB questions only I advise yous to google too larn to a greater extent than inward depth if fourth dimension permits you.
If yous are working inward Java technology scientific discipline too hence yous may abide by 10 multi-threading interview questions asked inward Investment banks too Struts interview questions interesting .
Here are 10 of my oftentimes asked EJB interview questions too answers :
EJB Interview Question too Answer
Question1: What do yous hateful past times EJB?
Ans: Most of the fourth dimension this EJB interview questions is the origin questions asked to interviewee, generally to cheque how he responds too how its is unlike than traditional Java beans. Enterprise coffee bean is a server side constituent which runs on application server or nosotros telephone telephone container, developed for the purpose of distributed too firm score application .container volition furnish back upward for organisation score services similar Transaction Management, safety which brand developer employment slow too he tin focus on line of piece of work concern logic.
Question 2: What are the unlike types of EJB?
This is about other beginner score EJB interview questions generally asked inward telephonic interviews too appeared inward 2 to 3 years experience score interviews. Mainly 3 types of EJB, Entity Bean, Session Bean too Message Driven Bean(MDB).
Types of EJB:
Entity Bean: it represents an entity which is mapped amongst database or nosotros tin say it makes OR object Relational mapping amongst Database. Entity edible bean typically stand upward for tabular array inward RDBMS too each event stand upward for row inward the table.
Two types of entity bean:
· CMP Entity bean: Container managed entity edible bean its responsibleness of container to acquire by the edible bean persistence behavior.
· BMP Entity bean: Programmer acquire by the edible bean persistence behavior.
Session bean: Session edible bean is responsible for developing line of piece of work concern logic it makes the customer server human relationship hence session beans be till at that spot is a session be betwixt customer too server, it doesn’t comprise persistent line of piece of work concern concept.
Types of session edible bean
· Stateless session bean: when at that spot is non demand to keep soil of a detail customer stateless session edible bean is used .They hold upward for brusque menstruum of time.
For instance if nosotros are validating the credit menu nosotros tin utilization stateless session bean.
· Stateful session bean: stateful session edible bean keep the conversational soil of customer over the series of method telephone telephone earlier the edible bean event goes to passive soil conversational soil is saved to persistence expanse similar Hard disk too i time again when same customer post a asking too edible bean event come upward into the active soil it volition come upward out from HD to primary memory.
For Example when nosotros do online banking transaction ,online reservation nosotros utilization stateful session bean
Message Driven Beans: these beans are piece of work every bit a listener for messaging services similar JMS .
Question 3: Explain the life bike method of EJB?
One for EJB interview questions which is asked inward Junior score interviews. I direct hold non seen this EJB enquiry appeared on to a greater extent than senior score interviews only its practiced to shout out back life bike every bit hither yous direct hold run a peril to demonstrate how much EJB yous know inward depth.
Ans: Life Cycle of Entity Bean:
First phase is Does Not Exist Stage t hen Container creates the event of EJB and call SetEntityContext() method which volition laid all entity context to edible bean too straight off it volition cash inward one's chips available on puddle ,to acquire a detail identity of an EJB object it has to motion from Pooled phase to laid upward stage which is done past times calling the create () method which inward turns telephone telephone ejbCreate() too ejbPostCreate() method .
There is about other way past times which straight entity edible bean tin motion to pooled phase to laid upward phase that’s is telephone telephone ejbActivate() method.now nosotros are laid upward to invoke the line of piece of work concern method of entity edible bean .After completion of line of piece of work concern method if nosotros desire to motion i time again inward pooled phase from laid upward phase nosotros tin telephone telephone remove() method which inward turns telephone telephone ejbRemove() or straight telephone telephone ejbPassivate () method.
At the destination container withdraw the event of EJBfrom puddle too telephone telephone unSetEntityContext().
Life Cycle of Stateful Session Bean :
Stateful session beans life bike starts when client telephone telephone create() method.The container create the event of session edible bean too telephone telephone setSessionContext() too ejbCreate() method
Now the stateful session edible bean is laid upward to serve the customer asking later serving the asking if it is non used later a long fourth dimension container tin motion this edible bean to passive stage past times calling the ejbPassivate() method.similarly when edible bean is inward passive phase too customer invoke the line of piece of work concern method the container telephone telephone ejbActivate() method to motion edible bean from passive phase to active or laid upward stage.
At the destination of life bike client call remove() method too container volition telephone telephone ejbRemove() method too edible bean is laid upward for garbage collection.
Life Cycle of Stateless session bean :
Stales session edible bean has brusque life bike it tin direct hold 2 phase does non be too laid upward stage. ejb container create the event of stateless session edible bean too call setSessionContext () too ejbCreate() method.Now the edible bean is laid upward to invoke line of piece of work concern method on this.it volition non keep the soil so withdraw () method is been called later completion of line of piece of work concern method which inward turns call ejbRemove () and straight off its laid upward for garbage collection.
Life bike of Message Driven bean:
MDBs direct hold same life bike similar stateless session bean. setMessageDrivenContext() method too ejbCreate() method is called past times container to create the event of MDB.now its laid upward to have message .and at the destination of lifecycle customer volition telephone telephone remove () method
which inward turns call ejbRemove () and straight off its laid upward for garbage collection.
Question iv : tin nosotros direct hold static initializer Block inward EJB.
This is i of the tricky EJB interview questions which makes yous think too about fourth dimension left yous stunned amongst feeling similar “ Ah , I haven’t idea virtually it”.
Ans .Purpose of Static initializer block is to initialize about static fields earlier whatever execution of constructor or method or nosotros tin say creation of object. According to EJB Spec it’s a violation if static acre are used too they are non finally .
“EJB Spec”
Enterprise edible bean are non allowed to read or write the non finally fields.
But technically,from the betoken of coffee its right only if inward EJB nosotros utilization static initializer block to initialize static acre too hence because EJB components are used inward distributed surround hateful to say if single JVM too hence it volition hold upward ok only if run on unlike JVM too hence it volition hold upward a employment if nosotros modify or update the value inward on surround too hence alone the event running on same JVM direct hold novel value .that’s why static blocks are avoided too every bit good all static acre should hold upward final.
And same matter nosotros tin reach inward ejbCreate(), setSessionContext() or setEntityContext() methods.
Question 5: Is threading is possible inward EJB?
Another tricky EJB interview question, I beloved to inquire this variety of enquiry because it shows existent cognition of EJB which is of import to avoid mistakes patch writing firm Java application.
Ans: No, Not possible because EJBs are created too managed past times container too if inward ejbs nosotros allow threading containers life bike methods volition hold upward interrupted past times us too every bit good the purpose of EJB is to perform line of piece of work concern logic non to controlling a organisation or implementation score functioning hence container volition acquire by the thread too developer tin concentrate on line of piece of work concern logic.
Question 6: What is connexion pooling characteristic of EJB container?
This EJB interview enquiry is neither tough nor easy, every bit most of Java programmer familiar amongst concept of connexion pooling that makes it slow only how EJB container does that is something yous desire to hear from interviewee.
Ans: Connection pooling is i of the Advance characteristic of container which enhanced our application performance .Using connexion pooling machinery customer are non required to create every fourth dimension connexion object to interact amongst database .Here inward puddle objects are already available Whenever a customer asking for a database connexion too hence an event is picked from the connexion puddle to acquire an access to database too when user consummate amongst his piece of work event is returned to connexion pool. There is a restrain specified past times App server administrator for the availability of set out of connections too beyond a specified restrain a predefined set out increases numbers of connexion puddle instances. When demand goes dorsum to normal too hence access amount of connexion puddle instances are removed.
Question 7: what is Session facade?
This is the most pop interview questions asked inward EJB inward connexion of Session Bean. Session facade non alone comport on concept of EJB only every bit good it checks pattern patterns cognition of interviewee.
Ans: Session Façade is i of the pattern pattern which is used inward EJB constituent inward this pattern session beans are used every bit a wrapper classes for entity edible bean too using session edible bean nosotros interact amongst Entity bean .it volition give clean approach towards customer access to edible bean components too every bit good cut back network calls hence every bit to brand the whole organisation of high performance.
Question 8:What are the transaction Attribute ?
This variety of EJB questions generally askedin telephonic interviews only believe me its non slow to reply if yous direct hold non actually used transaction administration characteristic of EJB. Its slow to mug all these transaction attribute too tumble inward interview only i time interviewer asked cross enquiry yous volition most probable cripple.
Ans: Transaction is grouping of functioning or piece of work which should hold upward performed either completely or none to keep the information integrity. All transaction must direct hold ACID property(atomicity ,consistency,integrity,durability) hence transaction tin hold upward said completed if nosotros commit on successful execution too rollback on unsuccessful execution.
There are 2 ways of transaction management.
· Declarative Transaction Mang.
· Programmatic Transaction Mang.
Now nosotros come across what the transactions Attribute are
Transaction Attribute conveys to the container the intended transactional demeanour of the associated EJB component's method.
Required: if required attribute is associated amongst Method too hence novel Transaction context may or may non hold upward created, agency if method is already associated amongst transaction context too hence no novel transaction context should hold upward created.
Requires New: if Requires New attribute is associated amongst Method too hence e'er novel Transaction context may hold upward created.
NotSupported:if Method is Associated amongst this Attribute too hence method is a non a component division of transaction.
Supported:if a Method is Associated amongst this transaction Attribute too hence method volition human activity every bit Not supported if calling constituent is non associated amongst transaction too if calling constituent is associated amongst transaction too hence human activity every bit a required Attribute.
Mandatory:if a method is Associated amongst this attribute too hence e'er hold upward called from calling constituent transaction context.
Never: if a method is Associated amongst this attribute too hence never be called from calling constituent transaction context.
The default transaction value for EJB is Support.
Question 9:Difference Between ejbStore() too ejbLoad()?
One to a greater extent than pop EJB interview question, non seen though it for about fourth dimension only notwithstanding an of import questions on EJB to prepare.
Ans:Both of these methods are used inward context of entity edible bean for the purpose of synchronizing the event variable to corresponding value shop inward the database. ejbLoad method charge or refresh the event variable from the database too ejbStore method writes variables value dorsum to the database.
Question 10: What is the divergence betwixt JNDI context, Initial context, session context too ejb context.
JNDI questions most probable asked inward whatever EJB interview hence hold upward laid upward for that every bit well.
Ans:
JNDI context: provides machinery to lookup resources on network.
Initial Context: it provides initial context to resources.
Session Context:it has all the information available which is required to session edible bean from container.
EjbContext:it comprise information which is required to both session too entity bean.
These were 10 oftentimes asked EJB interview questions too answers from my collection. I unremarkably write downwardly questions collected from my friends too collegue too tries to answers them, if don’t I endeavour to abide by it out. Its practiced to practise EJB questions earlier appearing inward whatever interview fifty-fifty if yous are working or direct hold worked on EJB.
Further Learning
10 Servlet interview questions asked inward J2EE interviews
0 Response to "Top X Ejb Interview Enquiry In Addition To Response Asked Inward Coffee J2ee Interviews"
Post a Comment