Exploring Enterprise Java Beans – Series II

Learning EJB

Pag-aaral ng EJB,,en,at malawakang ginagamit ang mga ito sa maraming mga malalaking aplikasyon sa sukat,,en,ilang oras,,en,nahihirapan kaming sagutin ang mga tukoy na katanungan na tinanong sa forum,,en,panayam o talakayan,,en,ang pinagsamang listahan ng mga katanungan at sagot ay tiyak na magbibigay sa iyo ng ilang ideya sa mga kaugnay na konsepto,,en,Ano ang dalawang iba pang mga yugto ng pag-ikot ng buhay na magagamit para sa estado na bean ng session,,en,Dalawa pang mga yugto ng siklo ng buhay ang,,en,I-prePassivate ang callback,,en,I-post ang aktibo sa callback,,en,Mayroon bang anumang oras out na halaga para sa stateful session beans,,en,mayroong isang time out na halaga para sa mga stateful session beans,,en,Kung ang bean ay hindi ginamit sa panahon ng time out na halaga pagkatapos ito ay tatanggalin ng lalagyan mismo,,en,Ngunit laging ipinapayong alisin ang bean pagkatapos ng paggamit nito nang hindi umaasa sa mekanismo ng time out,,en

Panimula: In this EJB II series, our main objective is to take some of the most important features of EJB and answer the related concepts. EJBs are there for a long time in the market, and they are widely used in many large scale applications. But, some time, we find it difficult to answer the specific questions asked in the forum, interviews or discussions. So, this compiled list of questions and answers will definitely give you some idea on the related concepts.







What are the two other life cycle stages available for stateful session bean?

Answer: Two other life cycle stages are
isang) PrePassivate callback
b) PostActivate callback

Is there any time out value for stateful session beans?

Answer: Yes, there is a time out value for stateful session beans. If the bean is not used during the time out value then it is deleted by the container itself. But it is always advisable to remove the bean after its use without relying on the time out mechanism.

What is the usage of interceptors in session beans or MDBs?

Answer: Interceptors are generally used to check validation, security checks before the invocation of business logic methods.

What is a default interceptor?

Answer: Default interceptor is a concept provided by the EJB 3.0 specification. It is not defined by any annotation rather it has to be written explicitly in the deployment descriptor of the EJB module.

What is the order of execution of different interceptors?

Answer: They are invoked in the following order
isang) Default interceptor
b) Class interceptor
c) Method interceptor

Is it possible to disable invocation of any interceptor?

Answer: Yes, Annotations like @ExcludeDefaultInterceptors and @ExcludeClassInterceptors can be used to disable invocation.

What is dependency injection in EJB 3.0 specification?

Answer: Dependency injection is a powerful way of obtaining Java EE resources without any JNDI look up. It makes the application loosely coupled.

What is the annotation used for EJB injection into a client code?

Answer: The ‘@EJB annotation’ is used to inject session beans into a client.

What is the annotation used for resource injection?

Answer: The ‘@Resource’ annotation is used for injecting resources.

Why setter injection is used?

Answer: The resources should not be directly injected into application code. The resources should be separated in a different component and it will make the code more flexible. The setter injection is used to serve this purpose.

What is the usage of deployment descriptor?

Answer: All the tasks in EJB 3.0 is done by annotations. But the same can be performed by using deployment descriptor.

What are the two name spaces available in EJB 3.0 feature pack?

Answer: Following are the two name spaces available
isang) JVM-scoped ejblocal: name space
b) Global JNDI name space







What is the name of the format used for packaging java enterprise applications?

Answer: The name of the format is enterprise application archive (EAR).It contains all other modules like WAR, RAR etc.

What is the name of the deployment descriptor used for deploying java enterprise application?

Answer: The name of the deployment descriptor is ejb-jar.xml.

What are the two default bindings used by the container?

Answer: The two default bindings are
isang) Short binding
b) Long binding

What is short binding?

Answer: In short binding, package-qualified Java class name of the interface is only used.

How the long binding is performed?

Answer: In long binding, bean’s component ID is used as an extra qualifier along with the package-qualified interface class name.

What are the different parts of a component ID?

Answer: The component ID for EJB is formed using the enterprise bean’s application name, module name and component name.

Where do you bind local interfaces?

Answer: All local interfaces are bound into the ejblocal: name space, which is accessible only within the same JVM.

Where do you bind the remote interfaces and why?

Answer: All the remote interfaces are bound into the global-scoped name space so that they are accessible from anywhere in the Websphere product cell.

What is the best practice for all EJB related bindings?

Answer: The best practice is to group all the EJB-related bindings under the EJB context.

Where do you provide user defined binding information?

Answer: Ang tinukoy ng gumagamit na nagbubuklod na impormasyon ay ibinibigay sa isang bagong nilikha na file na tinatawag na META-INF / ibm-ejb-jar-bnd.xml,,en,Ano ang magagamit na dalawang mga pagpipilian sa packaging,,en,Ang dalawang magagamit na mga pagpipilian ay ang mga sumusunod,,en,Paggamit ng isang proyekto sa Java o proyekto sa Java Utility,,en,Paggamit ng isang proyekto sa EJB,,en,Ano ang mai-e-edit sa tagapaglaraw ng pag-deploy kapag gumagamit ng pagpipiliang pag-packaging ng java,,en,Ang mga sumusunod na linya ay kailangang idagdag sa application.xml file,,en,ejb,,en,MyEJB3Module.jar,,en,Kailangan ba naming magdagdag ng anuman kung gumamit ng pagpipiliang EJB packaging,,en,kung gumagamit kami ng opsyon na proyekto ng EJB pagkatapos ay awtomatikong ina-update ng IDE ang application,,en,xml file at magtakda ng isang ejb-jar.xml file,,en,Ano ang paggamit ng ejb-jar.xml file sa EJB3.0 na detalye,,en.

What are the two packaging options available?

Answer: Two available options are as follows
isang) Using a Java project or Java Utility project
b) Using an EJB project







What is to be edited in the deployment descriptor when using the java packaging option?

Answer: The following lines need to be added in the application.xml file
<module>
<ejb>MyEJB3Module.jar</ejb>
</module>

Do we need to add anything if use EJB packaging option?

Answer: No, if we are using the EJB project option then the IDE automatically updates the application,xml file and set a ejb-jar.xml file.

What is the usage of ejb-jar.xml file in EJB3.0 specification?

Answer: According to the EJB3.0 specification it is not required to write anything in the ejb-jar.xml file because everything is mentioned through annotations. So the main usage of ejb-jar.xml file is to override the annotations or complete the details provided by the annotations.

What persistence model is used in EJB3.0 specification?

Answer: The java persistence API (JPA) is used in EJB3.0 specification.

What is the advantage of JPA?

Answer: JPA uses a pluggable service interface model. So it is easy to use with different provider implementations.

What are the three major parts of JPA?

Answer: Following are the three major parts of JPA
isang) The java persistence API
b) Object relational mapping metadata
c) Query language

What is entity in JPA?

Answer: The main object used for persistence in JPA is called entity.

Does entity extend/implement any class or interface?

Answer: No, ang nilalang ay isang payak na lumang object ng java at hindi ito nagpapalawak o nagpapatupad ng anumang mga klase o interface,,en,techalpine.com/exploring-enterprise-java-beans-series-ii,,en.







============================================= ============================================== Buy best TechAlpine Books on Amazon
============================================== ---------------------------------------------------------------- electrician ct chestnutelectric
error

Enjoy this blog? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share