Top X Ejb Interview Inquiry Too Answer Asked Inwards Coffee J2ee Interviews
Wednesday, February 27, 2019
Add Comment
10 EJB Interview Questions as well as Answer from my collection of interview questions. I have got been sharing interview questions on diverse topics similar Singleton interview question, serialization interview question as well as most late Spring interview questions. No dubiousness these questions are really of import from performing amend inward J2EE as well as EJB interviews exactly every bit good they opened upwards novel path for learning every bit you lot may honor unopen to concept novel fifty-fifty piece revising your cognition inward EJB. EJB interviews has e'er been tough because its hard to honor people who has hands on experience on Enterprise Java Beans (EJB) and most of the guys either have got worked solely on sample projection as well as non aware of critical functionalities similar distributed transaction management, container managed persistence as well as diverse other services which EJB provides. We volition meet unopen to of those inward 10 interview questions on EJB. I have got provided sample answers for these EJB questions exactly I advise you lot to google as well as larn to a greater extent than inward depth if fourth dimension permits you.
If you lot are working inward Java technology scientific discipline as well as thence you lot may honor 10 multi-threading interview questions asked inward Investment banks as well as Struts interview questions interesting .
Here are 10 of my oft asked EJB interview questions as well as answers :
EJB Interview Question as well as Answer
Question1: What do you lot hateful past times EJB?
Ans: Most of the fourth dimension this EJB interview questions is the starting fourth dimension questions asked to interviewee, generally to banking concern check how he responds as well as how its is dissimilar than traditional Java beans. Enterprise coffee bean is a server side element which runs on application server or nosotros telephone telephone container, developed for the purpose of distributed as well as firm marking application .container volition render back upwards for organization marking services similar Transaction Management, safety which brand developer chore tardily as well as he tin sack focus on concern logic.
Question 2: What are the dissimilar types of EJB?
This is unopen to other beginner marking EJB interview questions generally asked inward telephonic interviews as well as appeared inward 2 to 3 years experience marking interviews. Mainly iii types of EJB, Entity Bean, Session Bean as well as Message Driven Bean(MDB).
Types of EJB:
Entity Bean: it represents an entity which is mapped alongside database or nosotros tin sack say it makes OR object Relational mapping alongside Database. Entity edible bean typically correspond tabular array inward RDBMS as well as each event correspond row inward the table.
Two types of entity bean:
· CMP Entity bean: Container managed entity edible bean its responsibleness of container to cope the edible bean persistence behavior.
· BMP Entity bean: Programmer cope the edible bean persistence behavior.
Session bean: Session edible bean is responsible for developing concern logic it makes the customer server human relationship thence session beans be till at that spot is a session be betwixt customer as well as server, it doesn’t comprise persistent concern concept.
Types of session edible bean
· Stateless session bean: when at that spot is non demand to hold dry reason of a item customer stateless session edible bean is used .They endure for brusk menses of time.
For illustration if nosotros are validating the credit carte nosotros tin sack job stateless session bean.
· Stateful session bean: stateful session edible bean hold the conversational dry reason of customer over the series of method telephone telephone earlier the edible bean event goes to passive dry reason conversational dry reason is saved to persistence expanse similar Hard disk as well as over again when same customer post a asking as well as edible bean event come upwards into the active dry reason it volition come upwards out from HD to master copy memory.
For Example when nosotros do online banking transaction ,online reservation nosotros job 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 bicycle method of EJB?
One for EJB interview questions which is asked inward Junior marking interviews. I have got non seen this EJB query appeared on to a greater extent than senior marking interviews exactly its proficient to yell back life bicycle every bit hither you lot have got run a peril to present how much EJB you lot 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 as well as right away it volition conk available on puddle ,to acquire a item identity of an EJB object it has to motion from Pooled phase to laid upwards stage which is done past times calling the create () method which inward turns telephone telephone ejbCreate() as well as ejbPostCreate() method .
There is unopen to other way past times which direct entity edible bean tin sack motion to pooled phase to laid upwards phase that’s is telephone telephone ejbActivate() method.now nosotros are laid upwards to invoke the concern method of entity edible bean .After completion of concern method if nosotros desire to motion over again inward pooled phase from laid upwards phase nosotros tin sack telephone telephone remove() method which inward turns telephone telephone ejbRemove() or direct telephone telephone ejbPassivate () method.
At the destination container take the event of EJBfrom puddle as well as telephone telephone unSetEntityContext().
Life Cycle of Stateful Session Bean :
Stateful session beans life bicycle starts when client telephone telephone create() method.The container create the event of session edible bean as well as telephone telephone setSessionContext() as well as ejbCreate() method
Now the stateful session edible bean is laid upwards to serve the customer asking subsequently serving the asking if it is non used subsequently a long fourth dimension container tin sack motion this edible bean to passive stage past times calling the ejbPassivate() method.similarly when edible bean is inward passive phase as well as customer invoke the concern method the container telephone telephone ejbActivate() method to motion edible bean from passive phase to active or laid upwards stage.
At the destination of life bicycle client call remove() method as well as container volition telephone telephone ejbRemove() method as well as edible bean is laid upwards for garbage collection.
Life Cycle of Stateless session bean :
Stales session edible bean has brusk life bicycle it tin sack have got ii phase does non be as well as laid upwards stage. ejb container create the event of stateless session edible bean as well as call setSessionContext () as well as ejbCreate() method.Now the edible bean is laid upwards to invoke concern method on this.it volition non hold the dry reason so take () method is been called subsequently completion of concern method which inward turns call ejbRemove () and right away its laid upwards for garbage collection.
Life bicycle of Message Driven bean:
MDBs have got same life bicycle similar stateless session bean. setMessageDrivenContext() method as well as ejbCreate() method is called past times container to create the event of MDB.now its laid upwards to have message .and at the destination of lifecycle customer volition telephone telephone remove () method
which inward turns call ejbRemove () and right away its laid upwards for garbage collection.
Question iv : tin sack nosotros have got static initializer Block inward EJB.
This is 1 of the tricky EJB interview questions which makes you lot think as well as unopen to fourth dimension left you lot stunned alongside feeling similar “ Ah , I haven’t idea almost it”.
Ans .Purpose of Static initializer block is to initialize unopen to static fields earlier whatsoever execution of constructor or method or nosotros tin sack say creation of object. According to EJB Spec it’s a violation if static patch are used as well as they are non terminal .
“EJB Spec”
Enterprise edible bean are non allowed to read or write the non terminal fields.
But technically,from the yell for of coffee its right exactly if inward EJB nosotros job static initializer block to initialize static patch as well as thence because EJB components are used inward distributed surroundings hateful to say if single JVM as well as thence it volition endure ok exactly if run on dissimilar JVM as well as thence it volition endure a job if nosotros alter or update the value inward on surroundings as well as thence solely the event running on same JVM have got novel value .that’s why static blocks are avoided as well as every bit good all static patch should endure final.
And same affair nosotros tin sack accomplish inward ejbCreate(), setSessionContext() or setEntityContext() methods.
Question 5: Is threading is possible inward EJB?
Another tricky EJB interview question, I dear to inquire this sort of query because it shows existent cognition of EJB which is of import to avoid mistakes piece writing firm Java application.
Ans: No, Not possible because EJBs are created as well as managed past times container as well as if inward ejbs nosotros allow threading containers life bicycle methods volition endure interrupted past times us as well as every bit good the purpose of EJB is to perform concern logic non to controlling a organization or implementation marking functioning thence container volition cope the thread as well as developer tin sack concentrate on concern logic.
Question 6: What is connexion pooling characteristic of EJB container?
This EJB interview query is neither tough nor easy, every bit most of Java programmer familiar alongside concept of connexion pooling that makes it tardily exactly how EJB container does that is something you lot desire to hear from interviewee.
Ans: Connection pooling is 1 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 alongside database .Here inward puddle objects are already available Whenever a customer asking for a database connexion as well as thence an event is picked from the connexion puddle to acquire an access to database as well as when user consummate alongside his piece of work event is returned to connexion pool. There is a restrict specified past times App server administrator for the availability of disclose of connections as well as beyond a specified restrict a predefined disclose increases numbers of connexion puddle instances. When demand goes dorsum to normal as well as thence 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 solely affect concept of EJB exactly every bit good it checks pattern patterns cognition of interviewee.
Ans: Session Façade is 1 of the pattern pattern which is used inward EJB element inward this pattern session beans are used every bit a wrapper classes for entity edible bean as well as using session edible bean nosotros interact alongside Entity bean .it volition give clean approach towards customer access to edible bean components as well as every bit good cut network calls thence every bit to brand the whole organization of high performance.
Question 8:What are the transaction Attribute ?
This sort of EJB questions generally askedin telephonic interviews exactly believe me its non tardily to respond if you lot have got non actually used transaction management characteristic of EJB. Its tardily to mug all these transaction attribute as well as tumble inward interview exactly in 1 lawsuit interviewer asked cross query you lot volition most probable cripple.
Ans: Transaction is grouping of functioning or piece of work which should endure performed either completely or none to hold the information integrity. All transaction must have got ACID property(atomicity ,consistency,integrity,durability) thence transaction tin sack endure said completed if nosotros commit on successful execution as well as rollback on unsuccessful execution.
There are ii ways of transaction management.
· Declarative Transaction Mang.
· Programmatic Transaction Mang.
Now nosotros meet what the transactions Attribute are
Transaction Attribute conveys to the container the intended transactional behaviour of the associated EJB component's method.
Required: if required attribute is associated alongside Method as well as thence novel Transaction context may or may non endure created, agency if method is already associated alongside transaction context as well as thence no novel transaction context should endure created.
Requires New: if Requires New attribute is associated alongside Method as well as thence e'er novel Transaction context may endure created.
NotSupported:if Method is Associated alongside this Attribute as well as thence method is a non a component of transaction.
Supported:if a Method is Associated alongside this transaction Attribute as well as thence method volition human activeness every bit Not supported if calling element is non associated alongside transaction as well as if calling element is associated alongside transaction as well as thence human activeness every bit a required Attribute.
Mandatory:if a method is Associated alongside this attribute as well as thence e'er endure called from calling element transaction context.
Never: if a method is Associated alongside this attribute as well as thence never be called from calling element transaction context.
The default transaction value for EJB is Support.
Question 9:Difference Between ejbStore() as well as ejbLoad()?
One to a greater extent than pop EJB interview question, non seen though it for unopen to fourth dimension exactly nevertheless 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 as well as ejbStore method writes variables value dorsum to the database.
Question 10: What is the departure betwixt JNDI context, Initial context, session context as well as ejb context.
JNDI questions most probable asked inward whatsoever EJB interview thence endure laid upwards 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 as well as entity bean.
These were 10 oft asked EJB interview questions as well as answers from my collection. I unremarkably write downward questions collected from my friends as well as collegue as well as tries to answers them, if don’t I endeavor to honor it out. Its proficient to exercise EJB questions earlier appearing inward whatsoever interview fifty-fifty if you lot are working or have got worked on EJB.
Further Learning
10 Servlet interview questions asked inward J2EE interviews
0 Response to "Top X Ejb Interview Inquiry Too Answer Asked Inwards Coffee J2ee Interviews"
Post a Comment