SlideShare a Scribd company logo
1 of 20
Download to read offline
MyExamCloud
© EPractize Labs Software. All rights reserved
Presentation by MyExamCloud
Introduction to Java EE EJB Component
MyExamCloud
Introduction to Java EE EJB Component
This presentation deeply discusses the usage of EJB component in Java EE architecture.
Before start reading about EJB, it is advisable to understand the history behind
component-container architecture.
Introduction
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
The WWW technology is moved from 2 tier to 3 tier, 3 tier to n-tier and now n-tier to
SOA based solutions for easy integration and maintenance.
Evolution of Component-Container Architecture
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
Single Tier
Mainframe based systems where presentation, business logic and database are on
same node.
Evolution of Component-Container Architecture
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
Two-Tier
Client-Server model where presentation logic is moved to client machine.
Evolution of Component-Container Architecture
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
Three-Tier
Introducing browser based applications where web server will handle all requests.
Presentation, Business Logic and Database are separated.
Evolution of Component-Container Architecture
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
N-Tier
Introducing component-container approach with application server to run business
logic components. Presentation, Business Logic, Integration (Data/Legacy) and
Database.
Evolution of Component-Container Architecture
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
SOA
Service Oriented Architecture to interact with other systems. Both WSDL based SOAP or
JSON based web services are getting more popular in current trend.
Evolution of Component-Container Architecture
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
Normally, in N-Tiered applications we need to handle transaction and state management, multi-
threading, resource pooling, and other complex low-level services. The component-based and platform-
independent Java EE architecture simplifies these services with the help of containers. We just need to
write business logic and it is organized into reusable components.
The Java EE server provides underlying services in the form of a container for every component type.
Because we do not have to develop these services, we are free to concentrate on solving the business
problem at hand.
Java EE Containers
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
EJB is a component to write business logic in an enterprise application and it runs inside a container
named EJB container. The typical Java EE application server architecture is shown below:
Introducing EJB Component
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
The run-time portion of a Java EE product. A Java EE application server provides EJB and Web
containers.
Java EE Application Server
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
Manages the execution of EJBs for Java EE applications. Enterprise beans and their container run on the
Java EE application server.
Enterprise JavaBeans (EJB) container
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
Manages the execution of JSP page and servlet components for Java EE applications. Web components
and their container run on the Java EE application server.
Web container
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
Manages the execution of application client components. Application clients and their container run on
the client.
Application client container
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
Java EE provides the following EJB components.
1. Stateful Session Bean
2. Stateless Session Bean
3. Singleton Session Bean
4. Message Driven Bean
Note that Singleton bean is under session type introduced in Java EE 6.
EJB Components
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
Using Stateless Session Beans
You are developing a business component where it does not contain the data for a specific client. Your
search component will be a best example for this scenario. Note that search requires only one method
invocation with search query among all the clients to perform the generic task (executing search query
on server side).
Example: Google search, Yahoo search and MSN search.
The following contents are taken from Oracle:
When to use Stateful Session Bean:
If the bean does not contain the data for a specific client.
If there is only one method invocation among all the clients to perform the generic task.
EJB Design Decision
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
Using Stateful Session Beans
You are developing a business component where it wants to hold information about the client across
method invocation. The most common example for this type of implementation would be “Shopping
Cart”, where it needs to hold client specific information.
Example: Gmail, Yahoo Mail and Facebook.
The following contents are taken from Oracle:
When to use Stateful Session Bean:
What the bean wants to holds information about the client across method invocation.
When the bean works as the mediator between the client and the other component of the application.
When the bean have to manage the workflow of several other enterprise beans.
EJB Design Decision
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
Using Singleton Session Beans
You can easily decide by the name itself, when you want to have exactly one instance of a session bean
go for Singleton session bean. You are developing an application where you want to have some
configuration parameters needs to be used across different modules and they needs to be available
during your server startup. You can easily implement this scenario by using Singleton Session bean.
The following contents are taken from Oracle:
When to use Singleton Session Bean:
State needs to be shared across the application.
A single enterprise bean needs to be accessed by multiple threads concurrently.
The application needs an enterprise bean to perform tasks upon application startup and shutdown.
The bean implements a web service.
EJB Design Decision
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
Using Message Driven Beans
Unless like regular Java method calls MDBs are called asynchronously without blocking. Note that Java
EE 6. Note that Session beans allow you to send JMS messages and to receive them synchronously but
not asynchronously. To avoid tying up server resources, do not to use blocking synchronous receives in
a server-side component; in general, JMS messages should not be sent or received synchronously. To
receive messages asynchronously, we should use a message-driven bean.
EJB Design Decision
© EPractize Labs Software. All rights reserved
MyExamCloud
Introduction to Java EE EJB Component
One better way to study EJB is by taking Oracle’s Java EE 7 Developer Certification.
Prepare for your Java EE 7 Application Developer Certification using MyExamCloud course:
https://www.myexamcloud.com/onlineexam/1z0-900-mock-exams-ocp-java-ee-aplication-developer.course
Java EE 7 Developer Certification
© EPractize Labs Software. All rights reserved

More Related Content

Similar to Introduction to Java EE EJB Component

Enterprise application developement
Enterprise application developementEnterprise application developement
Enterprise application developementArchana Jha
 
JEE Course - EJB
JEE Course - EJBJEE Course - EJB
JEE Course - EJBodedns
 
Aravind vinnakota ejb_architecture
Aravind vinnakota ejb_architectureAravind vinnakota ejb_architecture
Aravind vinnakota ejb_architecturetayab4687
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts frameworks4al_com
 
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
Lecture 19 - Dynamic Web - JAVA - Part 1.pptLecture 19 - Dynamic Web - JAVA - Part 1.ppt
Lecture 19 - Dynamic Web - JAVA - Part 1.pptKalsoomTahir2
 
Free EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggetsFree EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggetsVirtual Nuggets
 
ADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.pptADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.pptrani marri
 
Servlets and jsp pages best practices
Servlets and jsp pages best practicesServlets and jsp pages best practices
Servlets and jsp pages best practicesejjavies
 
Sun Java EE 6 Overview
Sun Java EE 6 OverviewSun Java EE 6 Overview
Sun Java EE 6 Overviewsbobde
 
Bea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guideBea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guidePankaj Singh
 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to strutsAnup72
 

Similar to Introduction to Java EE EJB Component (20)

Enterprise application developement
Enterprise application developementEnterprise application developement
Enterprise application developement
 
JEE Course - EJB
JEE Course - EJBJEE Course - EJB
JEE Course - EJB
 
Aravind vinnakota ejb_architecture
Aravind vinnakota ejb_architectureAravind vinnakota ejb_architecture
Aravind vinnakota ejb_architecture
 
Java EE 7 introduction
Java EE 7  introductionJava EE 7  introduction
Java EE 7 introduction
 
Java ee introduction
Java ee introductionJava ee introduction
Java ee introduction
 
Ejbandjsp 200119145750
Ejbandjsp 200119145750Ejbandjsp 200119145750
Ejbandjsp 200119145750
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
 
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
Lecture 19 - Dynamic Web - JAVA - Part 1.pptLecture 19 - Dynamic Web - JAVA - Part 1.ppt
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
 
Frameworks in java
Frameworks in javaFrameworks in java
Frameworks in java
 
Free EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggetsFree EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggets
 
ADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.pptADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.ppt
 
Advance java1.1
Advance java1.1Advance java1.1
Advance java1.1
 
Servlets and jsp pages best practices
Servlets and jsp pages best practicesServlets and jsp pages best practices
Servlets and jsp pages best practices
 
Ejb and jsp
Ejb and jspEjb and jsp
Ejb and jsp
 
Sun Java EE 6 Overview
Sun Java EE 6 OverviewSun Java EE 6 Overview
Sun Java EE 6 Overview
 
Bea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guideBea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guide
 
Virtual Classroom
Virtual ClassroomVirtual Classroom
Virtual Classroom
 
Lec2 ecom fall16
Lec2 ecom fall16Lec2 ecom fall16
Lec2 ecom fall16
 
Java EE EJB Applications
Java EE EJB ApplicationsJava EE EJB Applications
Java EE EJB Applications
 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to struts
 

Recently uploaded

Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 

Recently uploaded (20)

Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 

Introduction to Java EE EJB Component

  • 1. MyExamCloud © EPractize Labs Software. All rights reserved Presentation by MyExamCloud Introduction to Java EE EJB Component
  • 2. MyExamCloud Introduction to Java EE EJB Component This presentation deeply discusses the usage of EJB component in Java EE architecture. Before start reading about EJB, it is advisable to understand the history behind component-container architecture. Introduction © EPractize Labs Software. All rights reserved
  • 3. MyExamCloud Introduction to Java EE EJB Component The WWW technology is moved from 2 tier to 3 tier, 3 tier to n-tier and now n-tier to SOA based solutions for easy integration and maintenance. Evolution of Component-Container Architecture © EPractize Labs Software. All rights reserved
  • 4. MyExamCloud Introduction to Java EE EJB Component Single Tier Mainframe based systems where presentation, business logic and database are on same node. Evolution of Component-Container Architecture © EPractize Labs Software. All rights reserved
  • 5. MyExamCloud Introduction to Java EE EJB Component Two-Tier Client-Server model where presentation logic is moved to client machine. Evolution of Component-Container Architecture © EPractize Labs Software. All rights reserved
  • 6. MyExamCloud Introduction to Java EE EJB Component Three-Tier Introducing browser based applications where web server will handle all requests. Presentation, Business Logic and Database are separated. Evolution of Component-Container Architecture © EPractize Labs Software. All rights reserved
  • 7. MyExamCloud Introduction to Java EE EJB Component N-Tier Introducing component-container approach with application server to run business logic components. Presentation, Business Logic, Integration (Data/Legacy) and Database. Evolution of Component-Container Architecture © EPractize Labs Software. All rights reserved
  • 8. MyExamCloud Introduction to Java EE EJB Component SOA Service Oriented Architecture to interact with other systems. Both WSDL based SOAP or JSON based web services are getting more popular in current trend. Evolution of Component-Container Architecture © EPractize Labs Software. All rights reserved
  • 9. MyExamCloud Introduction to Java EE EJB Component Normally, in N-Tiered applications we need to handle transaction and state management, multi- threading, resource pooling, and other complex low-level services. The component-based and platform- independent Java EE architecture simplifies these services with the help of containers. We just need to write business logic and it is organized into reusable components. The Java EE server provides underlying services in the form of a container for every component type. Because we do not have to develop these services, we are free to concentrate on solving the business problem at hand. Java EE Containers © EPractize Labs Software. All rights reserved
  • 10. MyExamCloud Introduction to Java EE EJB Component EJB is a component to write business logic in an enterprise application and it runs inside a container named EJB container. The typical Java EE application server architecture is shown below: Introducing EJB Component © EPractize Labs Software. All rights reserved
  • 11. MyExamCloud Introduction to Java EE EJB Component The run-time portion of a Java EE product. A Java EE application server provides EJB and Web containers. Java EE Application Server © EPractize Labs Software. All rights reserved
  • 12. MyExamCloud Introduction to Java EE EJB Component Manages the execution of EJBs for Java EE applications. Enterprise beans and their container run on the Java EE application server. Enterprise JavaBeans (EJB) container © EPractize Labs Software. All rights reserved
  • 13. MyExamCloud Introduction to Java EE EJB Component Manages the execution of JSP page and servlet components for Java EE applications. Web components and their container run on the Java EE application server. Web container © EPractize Labs Software. All rights reserved
  • 14. MyExamCloud Introduction to Java EE EJB Component Manages the execution of application client components. Application clients and their container run on the client. Application client container © EPractize Labs Software. All rights reserved
  • 15. MyExamCloud Introduction to Java EE EJB Component Java EE provides the following EJB components. 1. Stateful Session Bean 2. Stateless Session Bean 3. Singleton Session Bean 4. Message Driven Bean Note that Singleton bean is under session type introduced in Java EE 6. EJB Components © EPractize Labs Software. All rights reserved
  • 16. MyExamCloud Introduction to Java EE EJB Component Using Stateless Session Beans You are developing a business component where it does not contain the data for a specific client. Your search component will be a best example for this scenario. Note that search requires only one method invocation with search query among all the clients to perform the generic task (executing search query on server side). Example: Google search, Yahoo search and MSN search. The following contents are taken from Oracle: When to use Stateful Session Bean: If the bean does not contain the data for a specific client. If there is only one method invocation among all the clients to perform the generic task. EJB Design Decision © EPractize Labs Software. All rights reserved
  • 17. MyExamCloud Introduction to Java EE EJB Component Using Stateful Session Beans You are developing a business component where it wants to hold information about the client across method invocation. The most common example for this type of implementation would be “Shopping Cart”, where it needs to hold client specific information. Example: Gmail, Yahoo Mail and Facebook. The following contents are taken from Oracle: When to use Stateful Session Bean: What the bean wants to holds information about the client across method invocation. When the bean works as the mediator between the client and the other component of the application. When the bean have to manage the workflow of several other enterprise beans. EJB Design Decision © EPractize Labs Software. All rights reserved
  • 18. MyExamCloud Introduction to Java EE EJB Component Using Singleton Session Beans You can easily decide by the name itself, when you want to have exactly one instance of a session bean go for Singleton session bean. You are developing an application where you want to have some configuration parameters needs to be used across different modules and they needs to be available during your server startup. You can easily implement this scenario by using Singleton Session bean. The following contents are taken from Oracle: When to use Singleton Session Bean: State needs to be shared across the application. A single enterprise bean needs to be accessed by multiple threads concurrently. The application needs an enterprise bean to perform tasks upon application startup and shutdown. The bean implements a web service. EJB Design Decision © EPractize Labs Software. All rights reserved
  • 19. MyExamCloud Introduction to Java EE EJB Component Using Message Driven Beans Unless like regular Java method calls MDBs are called asynchronously without blocking. Note that Java EE 6. Note that Session beans allow you to send JMS messages and to receive them synchronously but not asynchronously. To avoid tying up server resources, do not to use blocking synchronous receives in a server-side component; in general, JMS messages should not be sent or received synchronously. To receive messages asynchronously, we should use a message-driven bean. EJB Design Decision © EPractize Labs Software. All rights reserved
  • 20. MyExamCloud Introduction to Java EE EJB Component One better way to study EJB is by taking Oracle’s Java EE 7 Developer Certification. Prepare for your Java EE 7 Application Developer Certification using MyExamCloud course: https://www.myexamcloud.com/onlineexam/1z0-900-mock-exams-ocp-java-ee-aplication-developer.course Java EE 7 Developer Certification © EPractize Labs Software. All rights reserved