SlideShare a Scribd company logo
1 of 40
The Latest in
Enterprise JavaBeans
Technology
Simon Ritter
Sun Microsystems, Inc
Technical Topics
•What is Enterprise JavaBeans?
•Objectives of EJB
•Enterprise JavaBeans Architecture
•Enterprise Beans (Session and Entity)
•Advanced EJB Topics
2
What is Enterprise JavaBeans?
• A specification from Sun Microsystems
• Enterprise JavaBeans defines a server component
model for the development and deployment of
Java applications based on a multi-tier,
distributed object architecture
• The Enterprise JavaBeans specification defines:
– A container model
– A definition of the services the container needs to
provide to an Enterprise JavaBean, and vice versa
– How a container should manage Enterprise JavaBeans
3
JavaBeans vs Enterprise JavaBeans
• Enterprise JavaBeans is a framework for
building and deploying server-side Java
components
• JavaBeans is a framework for client-side Java
components
• Conceptually related because both are
components
• The specifications are different
• The specifications do not build on each other
or rely on each other
4
What’s in the EJB Specification
• Goals for the Release
• Roles and Scenarios
• Fundamentals (Scope of EJB)
• Session and Entity Beans
• Transactions, Exceptions, Distribution
• EJB Bean and Container Responsibilities
• API Reference
EJB Vendors
Have to do all the WORK
6
What EJB Accomplishes
You can take any Java class and with little effort
make it a distributed, secure, transactional class
You can take any data source and make the data
source appear to be a collection of Java objects
– Eliminates distinction between data from a database
and any other source
– All information is accessed through Java objects
– All SQL is cleanly encapsulated in Java objects
• true object-oriented programming
• high reusability
– Database objects work with the full Java class library
7
What EJB Means to IT Groups
• Java everywhere - one language, one environment
– Java on the client
– Java in the middle tier
– Java in the database
• Easier to program
• Easier to maintain
• All platforms look the same
8
What EJB Means to Developers
• Developers can focus on writing business logic
rather than writing low-level infrastructure like
data access, concurrency, transactions, threading,
etc.
– Reduces complexity & development time
– Increases quality and reliability
• The knowledge you learn about EJB will be
portable among many different products because
EJB products are based on a common standard
• You will see greater reuse because your code is
located in shareable, server objects
9
What’s Unique About EJB
• Mandates a container model where common
services are declared, not programmed
– At development and/or deployment time, attributes
defining the bean’s transaction and security
characteristics are specified
– At deployment time, the container introspects the
Enterprise JavaBean attributes for the runtime services
it requires and wraps the bean with the required
functionality
– At runtime, the container intercepts all calls to the
object
10
Power of EJB
• Write a simple Java class
• Get a server-based,
transactional and secure class
automatically
• N-Tier made easy
11
Typical EJB Usage Scenario
Enterprise JavaBeans
Architecture
Enterprise JavaBeans Architecture
The EJB architecture specifies the responsibilities
and interactions among EJB entities
 EJB Servers
 Enterprise Beans  EJB Clients
 EJB Containers
EJB Server
EJB Container
Enterprise
Bean
Enterprise
Bean
Java Clients
13
EJB Server
EJB Server
• Provides a Runtime Environment
• The EJB Server provides system services and
manages resources
– Process and thread management
– System resources management
– Database connection pooling and caching
– Management API
14
EJB Server
EJB Container
EJB Container
• Provides a Run-time Environment for an
Enterprise Bean
• Hosts the Enterprise JavaBeans
• Provides services to Enterprise JavaBeans
– Naming
– Life cycle management
– Persistence (state management)
– Transaction Management
– Security
15
EJB Server
Enterprise JavaBeans Components
• A specialized Java class where the real business
logic lives
– May be developer-written or tool-generated
• Distributed over a network
• Transactional & Secure
• Server vendors provide tools that automatically
generate distribution, transaction and security
behavior
EJB Container
Enterprise
Bean
Enterprise
Bean
16
EJB Clients
• Client access is controlled by the container in
which the enterprise Bean is deployed
• Clients locates an Enterprise JavaBean
through Java Naming and Directory Interface
(JNDI)
• RMI is the standard method for accessing a
bean over a network
• CORBA is also supported
EJB Server
EJB Container
Enterprise
Bean
Enterprise
Bean
Java Clients
17
Enterprise Beans
 Enterprise Bean Components
 Session Beans
 Entity Beans
Written by Developer
Generated at Development
Generated at Deployment
Enterprise Bean Contents
• EJB Class is written by the developer
• Home and Remote interfaces and classes
control access to the EJB class
• Deployment Descriptor and MANIFEST
describe security and transactional
characteristics of the bean
20
EJB Jar File
EJB Class
Home
Interface
Remote
Interface
Home
Class
(Implementation)
Remote
Class
(Implementation)
Deployment
Descriptor
The Deployment Descriptor
• Allows declarative customization
• Created at deployment time
• Gives the container instructions on how to
manage the enterprise bean
• Controls behaviors for:
– Transaction
– Security
– Life cycle
– State management
– Persistence
Bean Development Process
EJB Jar File
EJB Class
Home
Interface
Remote
Interface
Home
Class
(Implementation)
Remote
Class
(Implementation)
Deployment
Descriptor
• Implement the EJB Class
• Specify the remote interface
• Specify the home interface
• Specify security and transactional characteristics
using vendor tools (Deployment Descriptor)
• Use vendor tools to
generate supporting
code and package
components in EJB-jar
• Iterate...
21
EJB Class
• A bean has a single Java class at its core
– This class is written by a developer or generated by a tool
• Implements application-specific business logic
• Implements one of the following contracts:
– javax.ejb.EntityBean &
javax.ejb.SessionBean
• These contracts provide for consistent behavior
when activating beans, passivating beans, reading
data, writing data
• Every container can expect these methods in every
bean
22
EJB Jar File
EJB Class
Home
Interface
Remote
Interface
Home
Class
Remote
Class
DD
Manifest
Remote Interface and Class
• Intercepts calls to the EJB Class to add support for:
– Transactions/security/threading
• Remote class has the same methods as the bean
and delegates to the bean for actual behavior
• Remote class checks security and sets up
transaction before delegating method call to the
bean
• Clients can never get a reference
to a bean’s EJB Class, only the
Remote interface
23
Home Interface and Class
EJB Jar File
EJB Class
Home
Interface
Remote
Interface
Home
Class
Remote
Class
DD
Manifest
• Used to get a reference to a bean’s remote
interface
• Provides bean creation services
– myFoo = FooHome.create() instead of
myFoo = new Foo()
– Supports multiple signatures to create EJB
instances
• Similar to class factory in COM
and CORBA
• May be generated by tools that
come with an EJB server
24
EJB Object Interactions
Remote Interface
Implements
Home Interface
Implements
Client
Calls Calls
Remote Class
Bean Class
Delegates
Home Class
Delegates
Returns
Client
Server
25
Comparing Session and Entity
Beans
• Mandatory for EJB 1.0
• Represents a specific
client
(1 instance per client)
• Short-lived
• Transient
• Can be any Java class
• May be transactional
• Optional for EJB 1.0
• Represents underlying
data object or context
(clients share instance)
• Long-lived
• Persistent
• Can be a class that
maps to persistent
data (e.g., database)
• Always transactional
Session Beans Entity Beans
26
Entity and Session Beans --
Typical Architecture
Database
Row 2
Row 7
Java Clients
Entity
Bean
Session
Bean
Session
Bean
Session
Bean
Entity
Bean
27
Session Beans Represents Process
• A transient agent for an individual client that
executes on a server (e.g., ShoppingCart)
• Session beans are often a client of multiple entity
beans
• Implements javax.ejb.SessionBean interface
• State management types for session EJBs
– stateful - session bean may maintain state information
across method calls
– stateless - session bean may be used to service multiple
clients
– a stateless session bean can only have a single no-
argument create() method in its Home interface
Entity Bean Represents State
Implements javax.ejb.EntityBean interface
• Maps a data source to a Java class
– table, view, join or stored procedure in a relational
database
– a set of related records in a database
– legacy data
• Each instance of an entity bean is one row of data
• Each instance of an entity bean is uniquely
identified by a primary key
• An Entity Bean can also have additional methods
for business logic, etc.28
EJB Persistence
• Provides Entity Beans the ability to store and
retrieve their state
• Can be implemented by a bean
– Bean Managed Persistence
• Can be implemented by a container
– Container Managed Persistence
50
Enterprise JavaBean Packaging
EJB Jar File
EJB Class
Home
Interface
Remote
Interface
Home
Class
Remote
Class
DD
Manifest
• Enterprise JavaBeans are comprised of many
Java files
• These files are put in a JAR file
– A JAR file is a ZIP file with a MANIFEST that
describes the contents of the file
– A MANIFEST is a simple text file
• A JAR file can contain more
than one Enterprise JavaBean
35
EJB Supporting
Technologies
 Java Transaction Service (JTS)
 Java Naming and Directory Interface (JNDI)
 The Object Bus (RMI, CORBA)
 Java Security
Java® 2 Platform Enterprise
Edition (J2EE)
Go to http://java.sun.com/marketing/enterprise/apis.html
for more information37
Java Transaction Service (JTS)
• JTS is an API specification that is used to
provide a common interface to transaction
managers
• JTS is needed because clients no longer talk
directly to databases, so a database commit is
not accessible to client
• Object-level transactions are provided in
place of database transactions by JTS
• The objects in the middle-tier will eventually
delegate to database for transactions
JTS
Java
Transaction
Service
A Standard
Transaction
Management
API
38
JTS Architecture
EJB Server
Commit
Bean Bean
Container
Transaction
Service
Java Clients
Database Database
39
Java Naming and Directory
Interface (JNDI)
• JNDI is an API specification that is used to
provide naming/directory services
• JNDI can be used to find files, printers, objects,
etc. on a network
• JNDI provides a common API on top of any
directory service product
– JNDI is partially implemented by JavaSoft
– Directory service products (LDAP, DNS, NDS, etc)
implement most of the specification
• JNDI is used in conjunction with RMI and EJB
to locate Enterprise JavaBeans on a server
JNDI
Java Naming
and Directory
Interface
Connectivity to
Enterprise
Naming and
Directory
Services
43
Java Application
JNDI Implementation
Manager
LDAP NDS
JNDI-
COSNaming
JNDI-RMI
Object Object Object
JNDI API
JNDI SPI
JNDI Architecture
JNDI
Java Naming
and Directory
Interface
Connectivity to
Enterprise
Naming and
Directory
Services
Remote Method Invocation (RMI)
• Remote Method Invocation (RMI) is a
standard that allows client computers to
access objects located on a server
– Java Software provides a complete implementation of RMI
– RMI puts a stub on the client computer that looks like the
object but is instead a proxy to the real object located on the
server
– Primary network protocol for RMI is Java Remote Method
Protocol (JRMP)
– RMI is used to make an Enterprise JavaBean accessible to
clients over a network
RMIStub
RMI
Skeleton
Application
Server
Bean
RMI
Java Remote
Method
Invocation
Distributed
Java-to-Java
Applications,
in JDK 1.1
46
Common Object Request
Broker Architecture (CORBA)
• CORBA is a standard for remotely referencing objects
written in any language and calling the methods on
those objects
• CORBA supports multi-language programming
– Client and server do not have to be the same language
• Primary network protocol for CORBA is IIOP
• Enterprise JavaBeans can use CORBA instead of RMI
– Makes the beans accessible from languages other than Java
– Simplifies configuration for organizations that have already
standardized on CORBA before introducing Java and EJB
into the organization
47
Summary
• Enterprise JavaBeans delivers mult-vendor,
OS independent standard for developing web-
based N-tier applications
• Java 2 Platform, Enterprise Edition is the
server-side platform delivering all the
Enterprise APIs

More Related Content

What's hot

WebSphere Portal Technical Overview
WebSphere Portal Technical OverviewWebSphere Portal Technical Overview
WebSphere Portal Technical OverviewVincent Perrin
 
WebSphere 6.1 Admin Course 1
WebSphere 6.1 Admin Course 1WebSphere 6.1 Admin Course 1
WebSphere 6.1 Admin Course 1odedns
 
Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...
Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...
Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...Chris Sparshott
 
WebSphere Application Server Information Resources
WebSphere Application Server Information ResourcesWebSphere Application Server Information Resources
WebSphere Application Server Information Resourcesejlp12
 
IBM WebSphere Portal - Die nächste Generation
IBM WebSphere Portal - Die nächste GenerationIBM WebSphere Portal - Die nächste Generation
IBM WebSphere Portal - Die nächste GenerationIBM Lotus
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6Bert Ertman
 
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGOverview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGMarakana Inc.
 
What's new in WebSphere Portal 8 roundtable 27 september 2012
What's new in WebSphere Portal 8 roundtable 27 september 2012What's new in WebSphere Portal 8 roundtable 27 september 2012
What's new in WebSphere Portal 8 roundtable 27 september 2012MooijBert
 
Websphere Portal
Websphere PortalWebsphere Portal
Websphere Portaldominion
 
Websphere Application Server V8.5
Websphere Application Server V8.5Websphere Application Server V8.5
Websphere Application Server V8.5IBM WebSphereIndia
 
01. Portal Business Overview
01. Portal Business Overview01. Portal Business Overview
01. Portal Business OverviewNick Davis
 
Sun Java EE 6 Overview
Sun Java EE 6 OverviewSun Java EE 6 Overview
Sun Java EE 6 Overviewsbobde
 
WebSphere application server 8.5.5 - quick overview
WebSphere application server 8.5.5 - quick overviewWebSphere application server 8.5.5 - quick overview
WebSphere application server 8.5.5 - quick overviewChris Sparshott
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewJava Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewEugene Bogaart
 
01 web sphere portal business overview
01 web sphere portal business overview01 web sphere portal business overview
01 web sphere portal business overviewygolani
 
What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5Vinayak Tavargeri
 
WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)
WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)
WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)WSO2
 
Java EE 6 Component Model Explained
Java EE 6 Component Model Explained Java EE 6 Component Model Explained
Java EE 6 Component Model Explained Shreedhar Ganapathy
 

What's hot (20)

Java language pppppt
Java language ppppptJava language pppppt
Java language pppppt
 
IBM WebSphere Portal
IBM WebSphere PortalIBM WebSphere Portal
IBM WebSphere Portal
 
WebSphere Portal Technical Overview
WebSphere Portal Technical OverviewWebSphere Portal Technical Overview
WebSphere Portal Technical Overview
 
WebSphere 6.1 Admin Course 1
WebSphere 6.1 Admin Course 1WebSphere 6.1 Admin Course 1
WebSphere 6.1 Admin Course 1
 
Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...
Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...
Integrating IBM Web Sphere Portal With Web Analytic Hosted And Non Hosted Sit...
 
WebSphere Application Server Information Resources
WebSphere Application Server Information ResourcesWebSphere Application Server Information Resources
WebSphere Application Server Information Resources
 
IBM WebSphere Portal - Die nächste Generation
IBM WebSphere Portal - Die nächste GenerationIBM WebSphere Portal - Die nächste Generation
IBM WebSphere Portal - Die nächste Generation
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6
 
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGOverview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUG
 
What's new in WebSphere Portal 8 roundtable 27 september 2012
What's new in WebSphere Portal 8 roundtable 27 september 2012What's new in WebSphere Portal 8 roundtable 27 september 2012
What's new in WebSphere Portal 8 roundtable 27 september 2012
 
Websphere Portal
Websphere PortalWebsphere Portal
Websphere Portal
 
Websphere Application Server V8.5
Websphere Application Server V8.5Websphere Application Server V8.5
Websphere Application Server V8.5
 
01. Portal Business Overview
01. Portal Business Overview01. Portal Business Overview
01. Portal Business Overview
 
Sun Java EE 6 Overview
Sun Java EE 6 OverviewSun Java EE 6 Overview
Sun Java EE 6 Overview
 
WebSphere application server 8.5.5 - quick overview
WebSphere application server 8.5.5 - quick overviewWebSphere application server 8.5.5 - quick overview
WebSphere application server 8.5.5 - quick overview
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewJava Enterprise Edition 6 Overview
Java Enterprise Edition 6 Overview
 
01 web sphere portal business overview
01 web sphere portal business overview01 web sphere portal business overview
01 web sphere portal business overview
 
What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5
 
WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)
WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)
WSO2Con2011: Using WSO2 ESB with SAP ERP (Retail)
 
Java EE 6 Component Model Explained
Java EE 6 Component Model Explained Java EE 6 Component Model Explained
Java EE 6 Component Model Explained
 

Similar to The Latest in Enterprise JavaBeans Technology

EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionEJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionKelum Senanayake
 
Lecture 8 Enterprise Java Beans (EJB)
Lecture 8  Enterprise Java Beans (EJB)Lecture 8  Enterprise Java Beans (EJB)
Lecture 8 Enterprise Java Beans (EJB)Fahad Golra
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Rohit Kelapure
 
Java online training from hyderabad
Java online training from hyderabadJava online training from hyderabad
Java online training from hyderabadrevanthonline
 
Ejb course-in-mumbai
Ejb course-in-mumbaiEjb course-in-mumbai
Ejb course-in-mumbaivibrantuser
 
Introduction to java_ee
Introduction to java_eeIntroduction to java_ee
Introduction to java_eeYogesh Bindwal
 
Enterprise beans
Enterprise beansEnterprise beans
Enterprise beansvpulec
 
Web Sphere Administration guide – Packaging and Deploying Jee Applications
Web Sphere Administration guide – Packaging and Deploying Jee ApplicationsWeb Sphere Administration guide – Packaging and Deploying Jee Applications
Web Sphere Administration guide – Packaging and Deploying Jee ApplicationsGagandeep Singh
 
Lecture 19 dynamic web - java - part 1
Lecture 19   dynamic web - java - part 1Lecture 19   dynamic web - java - part 1
Lecture 19 dynamic web - java - part 1Д. Ганаа
 

Similar to The Latest in Enterprise JavaBeans Technology (20)

EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionEJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another Introduction
 
EJB 3.0 and J2EE
EJB 3.0 and J2EEEJB 3.0 and J2EE
EJB 3.0 and J2EE
 
Unite5-EJB-2019.ppt
Unite5-EJB-2019.pptUnite5-EJB-2019.ppt
Unite5-EJB-2019.ppt
 
Ch4 ejb
Ch4 ejbCh4 ejb
Ch4 ejb
 
Lecture 8 Enterprise Java Beans (EJB)
Lecture 8  Enterprise Java Beans (EJB)Lecture 8  Enterprise Java Beans (EJB)
Lecture 8 Enterprise Java Beans (EJB)
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010
 
Java online training from hyderabad
Java online training from hyderabadJava online training from hyderabad
Java online training from hyderabad
 
Advance java1.1
Advance java1.1Advance java1.1
Advance java1.1
 
Ejb (1)
Ejb (1)Ejb (1)
Ejb (1)
 
Unit4wt
Unit4wtUnit4wt
Unit4wt
 
Unit4wt
Unit4wtUnit4wt
Unit4wt
 
Java Online Training
Java Online TrainingJava Online Training
Java Online Training
 
Virtual classroom
Virtual classroomVirtual classroom
Virtual classroom
 
Ejb course-in-mumbai
Ejb course-in-mumbaiEjb course-in-mumbai
Ejb course-in-mumbai
 
Introduction to java_ee
Introduction to java_eeIntroduction to java_ee
Introduction to java_ee
 
Ejb notes
Ejb notesEjb notes
Ejb notes
 
UNIT 4.pptx
UNIT 4.pptxUNIT 4.pptx
UNIT 4.pptx
 
Enterprise beans
Enterprise beansEnterprise beans
Enterprise beans
 
Web Sphere Administration guide – Packaging and Deploying Jee Applications
Web Sphere Administration guide – Packaging and Deploying Jee ApplicationsWeb Sphere Administration guide – Packaging and Deploying Jee Applications
Web Sphere Administration guide – Packaging and Deploying Jee Applications
 
Lecture 19 dynamic web - java - part 1
Lecture 19   dynamic web - java - part 1Lecture 19   dynamic web - java - part 1
Lecture 19 dynamic web - java - part 1
 

More from Simon Ritter

Cloud Native Compiler
Cloud Native CompilerCloud Native Compiler
Cloud Native CompilerSimon Ritter
 
The Art of Java Type Patterns
The Art of Java Type PatternsThe Art of Java Type Patterns
The Art of Java Type PatternsSimon Ritter
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java WorkshopSimon Ritter
 
Java performance monitoring
Java performance monitoringJava performance monitoring
Java performance monitoringSimon Ritter
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java WorkshopSimon Ritter
 
Getting the Most From Modern Java
Getting the Most From Modern JavaGetting the Most From Modern Java
Getting the Most From Modern JavaSimon Ritter
 
Building a Better JVM
Building a Better JVMBuilding a Better JVM
Building a Better JVMSimon Ritter
 
JDK 14 Lots of New Features
JDK 14 Lots of New FeaturesJDK 14 Lots of New Features
JDK 14 Lots of New FeaturesSimon Ritter
 
How to Choose a JDK
How to Choose a JDKHow to Choose a JDK
How to Choose a JDKSimon Ritter
 
Is Java Still Free?
Is Java Still Free?Is Java Still Free?
Is Java Still Free?Simon Ritter
 
Moving Towards JDK 12
Moving Towards JDK 12Moving Towards JDK 12
Moving Towards JDK 12Simon Ritter
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondSimon Ritter
 
Java Is Still Free
Java Is Still FreeJava Is Still Free
Java Is Still FreeSimon Ritter
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondSimon Ritter
 
JDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep DiveJDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep DiveSimon Ritter
 
Java Support: What's changing
Java Support:  What's changingJava Support:  What's changing
Java Support: What's changingSimon Ritter
 

More from Simon Ritter (20)

Cloud Native Compiler
Cloud Native CompilerCloud Native Compiler
Cloud Native Compiler
 
Java On CRaC
Java On CRaCJava On CRaC
Java On CRaC
 
The Art of Java Type Patterns
The Art of Java Type PatternsThe Art of Java Type Patterns
The Art of Java Type Patterns
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
 
Java performance monitoring
Java performance monitoringJava performance monitoring
Java performance monitoring
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
 
Getting the Most From Modern Java
Getting the Most From Modern JavaGetting the Most From Modern Java
Getting the Most From Modern Java
 
Building a Better JVM
Building a Better JVMBuilding a Better JVM
Building a Better JVM
 
JDK 14 Lots of New Features
JDK 14 Lots of New FeaturesJDK 14 Lots of New Features
JDK 14 Lots of New Features
 
Java after 8
Java after 8Java after 8
Java after 8
 
How to Choose a JDK
How to Choose a JDKHow to Choose a JDK
How to Choose a JDK
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Is Java Still Free?
Is Java Still Free?Is Java Still Free?
Is Java Still Free?
 
Moving Towards JDK 12
Moving Towards JDK 12Moving Towards JDK 12
Moving Towards JDK 12
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
 
Java Is Still Free
Java Is Still FreeJava Is Still Free
Java Is Still Free
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
 
JDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep DiveJDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep Dive
 
JDK 9 Deep Dive
JDK 9 Deep DiveJDK 9 Deep Dive
JDK 9 Deep Dive
 
Java Support: What's changing
Java Support:  What's changingJava Support:  What's changing
Java Support: What's changing
 

Recently uploaded

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
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
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
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
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 

Recently uploaded (20)

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
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
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
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
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 

The Latest in Enterprise JavaBeans Technology

  • 1. The Latest in Enterprise JavaBeans Technology Simon Ritter Sun Microsystems, Inc
  • 2. Technical Topics •What is Enterprise JavaBeans? •Objectives of EJB •Enterprise JavaBeans Architecture •Enterprise Beans (Session and Entity) •Advanced EJB Topics 2
  • 3. What is Enterprise JavaBeans? • A specification from Sun Microsystems • Enterprise JavaBeans defines a server component model for the development and deployment of Java applications based on a multi-tier, distributed object architecture • The Enterprise JavaBeans specification defines: – A container model – A definition of the services the container needs to provide to an Enterprise JavaBean, and vice versa – How a container should manage Enterprise JavaBeans 3
  • 4. JavaBeans vs Enterprise JavaBeans • Enterprise JavaBeans is a framework for building and deploying server-side Java components • JavaBeans is a framework for client-side Java components • Conceptually related because both are components • The specifications are different • The specifications do not build on each other or rely on each other 4
  • 5. What’s in the EJB Specification • Goals for the Release • Roles and Scenarios • Fundamentals (Scope of EJB) • Session and Entity Beans • Transactions, Exceptions, Distribution • EJB Bean and Container Responsibilities • API Reference EJB Vendors Have to do all the WORK 6
  • 6. What EJB Accomplishes You can take any Java class and with little effort make it a distributed, secure, transactional class You can take any data source and make the data source appear to be a collection of Java objects – Eliminates distinction between data from a database and any other source – All information is accessed through Java objects – All SQL is cleanly encapsulated in Java objects • true object-oriented programming • high reusability – Database objects work with the full Java class library 7
  • 7. What EJB Means to IT Groups • Java everywhere - one language, one environment – Java on the client – Java in the middle tier – Java in the database • Easier to program • Easier to maintain • All platforms look the same 8
  • 8. What EJB Means to Developers • Developers can focus on writing business logic rather than writing low-level infrastructure like data access, concurrency, transactions, threading, etc. – Reduces complexity & development time – Increases quality and reliability • The knowledge you learn about EJB will be portable among many different products because EJB products are based on a common standard • You will see greater reuse because your code is located in shareable, server objects 9
  • 9. What’s Unique About EJB • Mandates a container model where common services are declared, not programmed – At development and/or deployment time, attributes defining the bean’s transaction and security characteristics are specified – At deployment time, the container introspects the Enterprise JavaBean attributes for the runtime services it requires and wraps the bean with the required functionality – At runtime, the container intercepts all calls to the object 10
  • 10. Power of EJB • Write a simple Java class • Get a server-based, transactional and secure class automatically • N-Tier made easy 11
  • 11. Typical EJB Usage Scenario
  • 13. Enterprise JavaBeans Architecture The EJB architecture specifies the responsibilities and interactions among EJB entities  EJB Servers  Enterprise Beans  EJB Clients  EJB Containers EJB Server EJB Container Enterprise Bean Enterprise Bean Java Clients 13
  • 14. EJB Server EJB Server • Provides a Runtime Environment • The EJB Server provides system services and manages resources – Process and thread management – System resources management – Database connection pooling and caching – Management API 14
  • 15. EJB Server EJB Container EJB Container • Provides a Run-time Environment for an Enterprise Bean • Hosts the Enterprise JavaBeans • Provides services to Enterprise JavaBeans – Naming – Life cycle management – Persistence (state management) – Transaction Management – Security 15
  • 16. EJB Server Enterprise JavaBeans Components • A specialized Java class where the real business logic lives – May be developer-written or tool-generated • Distributed over a network • Transactional & Secure • Server vendors provide tools that automatically generate distribution, transaction and security behavior EJB Container Enterprise Bean Enterprise Bean 16
  • 17. EJB Clients • Client access is controlled by the container in which the enterprise Bean is deployed • Clients locates an Enterprise JavaBean through Java Naming and Directory Interface (JNDI) • RMI is the standard method for accessing a bean over a network • CORBA is also supported EJB Server EJB Container Enterprise Bean Enterprise Bean Java Clients 17
  • 18. Enterprise Beans  Enterprise Bean Components  Session Beans  Entity Beans
  • 19. Written by Developer Generated at Development Generated at Deployment Enterprise Bean Contents • EJB Class is written by the developer • Home and Remote interfaces and classes control access to the EJB class • Deployment Descriptor and MANIFEST describe security and transactional characteristics of the bean 20 EJB Jar File EJB Class Home Interface Remote Interface Home Class (Implementation) Remote Class (Implementation) Deployment Descriptor
  • 20. The Deployment Descriptor • Allows declarative customization • Created at deployment time • Gives the container instructions on how to manage the enterprise bean • Controls behaviors for: – Transaction – Security – Life cycle – State management – Persistence
  • 21. Bean Development Process EJB Jar File EJB Class Home Interface Remote Interface Home Class (Implementation) Remote Class (Implementation) Deployment Descriptor • Implement the EJB Class • Specify the remote interface • Specify the home interface • Specify security and transactional characteristics using vendor tools (Deployment Descriptor) • Use vendor tools to generate supporting code and package components in EJB-jar • Iterate... 21
  • 22. EJB Class • A bean has a single Java class at its core – This class is written by a developer or generated by a tool • Implements application-specific business logic • Implements one of the following contracts: – javax.ejb.EntityBean & javax.ejb.SessionBean • These contracts provide for consistent behavior when activating beans, passivating beans, reading data, writing data • Every container can expect these methods in every bean 22
  • 23. EJB Jar File EJB Class Home Interface Remote Interface Home Class Remote Class DD Manifest Remote Interface and Class • Intercepts calls to the EJB Class to add support for: – Transactions/security/threading • Remote class has the same methods as the bean and delegates to the bean for actual behavior • Remote class checks security and sets up transaction before delegating method call to the bean • Clients can never get a reference to a bean’s EJB Class, only the Remote interface 23
  • 24. Home Interface and Class EJB Jar File EJB Class Home Interface Remote Interface Home Class Remote Class DD Manifest • Used to get a reference to a bean’s remote interface • Provides bean creation services – myFoo = FooHome.create() instead of myFoo = new Foo() – Supports multiple signatures to create EJB instances • Similar to class factory in COM and CORBA • May be generated by tools that come with an EJB server 24
  • 25. EJB Object Interactions Remote Interface Implements Home Interface Implements Client Calls Calls Remote Class Bean Class Delegates Home Class Delegates Returns Client Server 25
  • 26. Comparing Session and Entity Beans • Mandatory for EJB 1.0 • Represents a specific client (1 instance per client) • Short-lived • Transient • Can be any Java class • May be transactional • Optional for EJB 1.0 • Represents underlying data object or context (clients share instance) • Long-lived • Persistent • Can be a class that maps to persistent data (e.g., database) • Always transactional Session Beans Entity Beans 26
  • 27. Entity and Session Beans -- Typical Architecture Database Row 2 Row 7 Java Clients Entity Bean Session Bean Session Bean Session Bean Entity Bean
  • 28. 27 Session Beans Represents Process • A transient agent for an individual client that executes on a server (e.g., ShoppingCart) • Session beans are often a client of multiple entity beans • Implements javax.ejb.SessionBean interface • State management types for session EJBs – stateful - session bean may maintain state information across method calls – stateless - session bean may be used to service multiple clients – a stateless session bean can only have a single no- argument create() method in its Home interface
  • 29. Entity Bean Represents State Implements javax.ejb.EntityBean interface • Maps a data source to a Java class – table, view, join or stored procedure in a relational database – a set of related records in a database – legacy data • Each instance of an entity bean is one row of data • Each instance of an entity bean is uniquely identified by a primary key • An Entity Bean can also have additional methods for business logic, etc.28
  • 30. EJB Persistence • Provides Entity Beans the ability to store and retrieve their state • Can be implemented by a bean – Bean Managed Persistence • Can be implemented by a container – Container Managed Persistence 50
  • 31. Enterprise JavaBean Packaging EJB Jar File EJB Class Home Interface Remote Interface Home Class Remote Class DD Manifest • Enterprise JavaBeans are comprised of many Java files • These files are put in a JAR file – A JAR file is a ZIP file with a MANIFEST that describes the contents of the file – A MANIFEST is a simple text file • A JAR file can contain more than one Enterprise JavaBean 35
  • 32. EJB Supporting Technologies  Java Transaction Service (JTS)  Java Naming and Directory Interface (JNDI)  The Object Bus (RMI, CORBA)  Java Security
  • 33. Java® 2 Platform Enterprise Edition (J2EE) Go to http://java.sun.com/marketing/enterprise/apis.html for more information37
  • 34. Java Transaction Service (JTS) • JTS is an API specification that is used to provide a common interface to transaction managers • JTS is needed because clients no longer talk directly to databases, so a database commit is not accessible to client • Object-level transactions are provided in place of database transactions by JTS • The objects in the middle-tier will eventually delegate to database for transactions JTS Java Transaction Service A Standard Transaction Management API 38
  • 35. JTS Architecture EJB Server Commit Bean Bean Container Transaction Service Java Clients Database Database 39
  • 36. Java Naming and Directory Interface (JNDI) • JNDI is an API specification that is used to provide naming/directory services • JNDI can be used to find files, printers, objects, etc. on a network • JNDI provides a common API on top of any directory service product – JNDI is partially implemented by JavaSoft – Directory service products (LDAP, DNS, NDS, etc) implement most of the specification • JNDI is used in conjunction with RMI and EJB to locate Enterprise JavaBeans on a server JNDI Java Naming and Directory Interface Connectivity to Enterprise Naming and Directory Services 43
  • 37. Java Application JNDI Implementation Manager LDAP NDS JNDI- COSNaming JNDI-RMI Object Object Object JNDI API JNDI SPI JNDI Architecture JNDI Java Naming and Directory Interface Connectivity to Enterprise Naming and Directory Services
  • 38. Remote Method Invocation (RMI) • Remote Method Invocation (RMI) is a standard that allows client computers to access objects located on a server – Java Software provides a complete implementation of RMI – RMI puts a stub on the client computer that looks like the object but is instead a proxy to the real object located on the server – Primary network protocol for RMI is Java Remote Method Protocol (JRMP) – RMI is used to make an Enterprise JavaBean accessible to clients over a network RMIStub RMI Skeleton Application Server Bean RMI Java Remote Method Invocation Distributed Java-to-Java Applications, in JDK 1.1 46
  • 39. Common Object Request Broker Architecture (CORBA) • CORBA is a standard for remotely referencing objects written in any language and calling the methods on those objects • CORBA supports multi-language programming – Client and server do not have to be the same language • Primary network protocol for CORBA is IIOP • Enterprise JavaBeans can use CORBA instead of RMI – Makes the beans accessible from languages other than Java – Simplifies configuration for organizations that have already standardized on CORBA before introducing Java and EJB into the organization 47
  • 40. Summary • Enterprise JavaBeans delivers mult-vendor, OS independent standard for developing web- based N-tier applications • Java 2 Platform, Enterprise Edition is the server-side platform delivering all the Enterprise APIs