SlideShare a Scribd company logo
1 of 22
Stateful Session Beans Session 4
Session Objectives ,[object Object],[object Object],[object Object],[object Object]
Review of Session 3 (1 of 3) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Review of Session 3 (2 of 3) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Review of Session 3 (3 of 3) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Characteristics of Stateful Session  Beans ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rules for Conversational State Storage Converted   to Memory freed Bit - blob Conversational   state  of a bean Written to storage  in case of  passivation Read from storage into memory in case  of activation Converted   into  data from bit-blob
Passivation of a Stateful Bean Client EJB Object Enterprise bean Other Enterprise beans Storage 1. Invoke business methods 5. Store passivated bean state The EJB Container/Server 2. Take the least recently used bean 3. Call ejbPassivate()  4. Serialize the bean state
Activation of a Stateful Bean Enterprise  Beans EJB  Object Other Enterprise Beans Storage Client EJB Container/Server 3. Reconstruct bean 4. Call ejbActivate() 5. Invoke business  method 1. Invoke business methods 2. Retrieve the  passivated state of bean
Requirements for Stateful session beans.   ,[object Object],[object Object],[object Object],[object Object],[object Object]
The Remote Interface Client Stateful Session  Bean Class 1. number() { / Implementation } Remote Interface (Defines business methods of bean) 1. number() Number extends EJBObject
The Bean Class Stateful Session Bean Class public int number(){ /* Actual Implementation*/ } public class Numberbean implements  SessionBean private SessionContext ctx; public int  answer; public void ejbCreate(int answer) throws CreateException public void ejbRemove() public void ejbActivate() public void ejbPassivate() public void setSessionContext(SessionContext ctx)
The Home Interface import javax.ejb.*; import java.rmi.*;     public interface Numberhome extends EJBHome {   Number  create( int answer ) throws  RemoteException, CreateException ;     }
Goals of the Client Code ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Deployment Descriptor : ejb-jar.xml ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
jboss.xml ,[object Object],[object Object],<jboss> <enterprise-beans> <session>   <ejb-name>Number</ejb-name>   <jndi-name>Number</jndi-name> </session> </enterprise-beans> </jboss>
Creating the jar file ,[object Object],[object Object],[object Object],[object Object]
Advantages  and Disadvantages of Stateless Session bean ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Advantages and Disadvantages of Stateful Session Beans ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Practices used for writing Stateful Session Beans ,[object Object],[object Object],[object Object]
Summary - 1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Summary - 2 ,[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

Ejb - september 2006
Ejb  - september 2006Ejb  - september 2006
Ejb - september 2006
achraf_ing
 
Ejb 2.0
Ejb 2.0Ejb 2.0
Ejb 2.0
sukace
 
Session 3 Tp3
Session 3 Tp3Session 3 Tp3
Session 3 Tp3
phanleson
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010
Rohit Kelapure
 

What's hot (20)

EJB3 Basics
EJB3 BasicsEJB3 Basics
EJB3 Basics
 
EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionEJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another Introduction
 
EJB3 Advance Features
EJB3 Advance FeaturesEJB3 Advance Features
EJB3 Advance Features
 
Lecture 8 Enterprise Java Beans (EJB)
Lecture 8  Enterprise Java Beans (EJB)Lecture 8  Enterprise Java Beans (EJB)
Lecture 8 Enterprise Java Beans (EJB)
 
Java bean
Java beanJava bean
Java bean
 
EJB Clients
EJB ClientsEJB Clients
EJB Clients
 
Ejb3.1 for the starter
Ejb3.1 for the starterEjb3.1 for the starter
Ejb3.1 for the starter
 
Ejb notes
Ejb notesEjb notes
Ejb notes
 
Entity beans in java
Entity beans in javaEntity beans in java
Entity beans in java
 
enterprise java bean
enterprise java beanenterprise java bean
enterprise java bean
 
Java EE EJB Applications
Java EE EJB ApplicationsJava EE EJB Applications
Java EE EJB Applications
 
EJB 3.0 and J2EE
EJB 3.0 and J2EEEJB 3.0 and J2EE
EJB 3.0 and J2EE
 
Ejb - september 2006
Ejb  - september 2006Ejb  - september 2006
Ejb - september 2006
 
Ejb 2.0
Ejb 2.0Ejb 2.0
Ejb 2.0
 
Session bean
Session beanSession bean
Session bean
 
Ch4 ejb
Ch4 ejbCh4 ejb
Ch4 ejb
 
Skillwise EJB3.0 training
Skillwise EJB3.0 trainingSkillwise EJB3.0 training
Skillwise EJB3.0 training
 
EJB Interview Questions
EJB Interview QuestionsEJB Interview Questions
EJB Interview Questions
 
Session 3 Tp3
Session 3 Tp3Session 3 Tp3
Session 3 Tp3
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010
 

Similar to Session 4 Tp4

Session 6 Tp6
Session 6 Tp6Session 6 Tp6
Session 6 Tp6
phanleson
 
J2EE - Practical Overview
J2EE - Practical OverviewJ2EE - Practical Overview
J2EE - Practical Overview
Svetlin Nakov
 
Session 7 Tp7
Session 7 Tp7Session 7 Tp7
Session 7 Tp7
phanleson
 
Session 5 Tp5
Session 5 Tp5Session 5 Tp5
Session 5 Tp5
phanleson
 
Enterprise java beans(ejb)
Enterprise java beans(ejb)Enterprise java beans(ejb)
Enterprise java beans(ejb)
vikram singh
 
Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2
vikram singh
 
Enterprise Java Beans( E)
Enterprise  Java  Beans( E)Enterprise  Java  Beans( E)
Enterprise Java Beans( E)
vikram singh
 
Session 2 Tp2
Session 2 Tp2Session 2 Tp2
Session 2 Tp2
phanleson
 
Enterprise java beans(ejb)
Enterprise java beans(ejb)Enterprise java beans(ejb)
Enterprise java beans(ejb)
vikram singh
 
EJB 3.1 by Bert Ertman
EJB 3.1 by Bert ErtmanEJB 3.1 by Bert Ertman
EJB 3.1 by Bert Ertman
Stephan Janssen
 

Similar to Session 4 Tp4 (20)

Session 6 Tp6
Session 6 Tp6Session 6 Tp6
Session 6 Tp6
 
1-introduction to ejb
1-introduction to ejb1-introduction to ejb
1-introduction to ejb
 
J2 Ee Overview
J2 Ee OverviewJ2 Ee Overview
J2 Ee Overview
 
J2EE - Practical Overview
J2EE - Practical OverviewJ2EE - Practical Overview
J2EE - Practical Overview
 
Session 7 Tp7
Session 7 Tp7Session 7 Tp7
Session 7 Tp7
 
Ecom lec3 16_ej_bs
Ecom lec3 16_ej_bsEcom lec3 16_ej_bs
Ecom lec3 16_ej_bs
 
EJB 3.1 and GlassFish v3 Prelude
EJB 3.1 and GlassFish v3 PreludeEJB 3.1 and GlassFish v3 Prelude
EJB 3.1 and GlassFish v3 Prelude
 
The Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologyThe Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans Technology
 
Session 5 Tp5
Session 5 Tp5Session 5 Tp5
Session 5 Tp5
 
Enterprise java beans(ejb)
Enterprise java beans(ejb)Enterprise java beans(ejb)
Enterprise java beans(ejb)
 
Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2Enterprise java beans(ejb) update 2
Enterprise java beans(ejb) update 2
 
EJB et WS (Montreal JUG - 12 mai 2011)
EJB et WS (Montreal JUG - 12 mai 2011)EJB et WS (Montreal JUG - 12 mai 2011)
EJB et WS (Montreal JUG - 12 mai 2011)
 
Enterprise Java Beans( E)
Enterprise  Java  Beans( E)Enterprise  Java  Beans( E)
Enterprise Java Beans( E)
 
JBoss AS7 OSDC 2011
JBoss AS7 OSDC 2011JBoss AS7 OSDC 2011
JBoss AS7 OSDC 2011
 
Virtual Classroom
Virtual ClassroomVirtual Classroom
Virtual Classroom
 
What's New in Enterprise JavaBean Technology ?
What's New in Enterprise JavaBean Technology ?What's New in Enterprise JavaBean Technology ?
What's New in Enterprise JavaBean Technology ?
 
Session 2 Tp2
Session 2 Tp2Session 2 Tp2
Session 2 Tp2
 
Enterprise java beans(ejb)
Enterprise java beans(ejb)Enterprise java beans(ejb)
Enterprise java beans(ejb)
 
Unite5-EJB-2019.ppt
Unite5-EJB-2019.pptUnite5-EJB-2019.ppt
Unite5-EJB-2019.ppt
 
EJB 3.1 by Bert Ertman
EJB 3.1 by Bert ErtmanEJB 3.1 by Bert Ertman
EJB 3.1 by Bert Ertman
 

More from phanleson

Lecture 1 - Getting to know XML
Lecture 1 - Getting to know XMLLecture 1 - Getting to know XML
Lecture 1 - Getting to know XML
phanleson
 

More from phanleson (20)

Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Spark
 
Firewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth FirewallsFirewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth Firewalls
 
Mobile Security - Wireless hacking
Mobile Security - Wireless hackingMobile Security - Wireless hacking
Mobile Security - Wireless hacking
 
Authentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless ProtocolsAuthentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless Protocols
 
E-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server AttacksE-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server Attacks
 
Hacking web applications
Hacking web applicationsHacking web applications
Hacking web applications
 
HBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table designHBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table design
 
HBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - OperationsHBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - Operations
 
Hbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBaseHbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBase
 
Learning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlibLearning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlib
 
Learning spark ch10 - Spark Streaming
Learning spark ch10 - Spark StreamingLearning spark ch10 - Spark Streaming
Learning spark ch10 - Spark Streaming
 
Learning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQLLearning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQL
 
Learning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a ClusterLearning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a Cluster
 
Learning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark ProgrammingLearning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark Programming
 
Learning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your DataLearning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your Data
 
Learning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value PairsLearning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value Pairs
 
Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Spark
 
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about LibertagiaHướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
 
Lecture 1 - Getting to know XML
Lecture 1 - Getting to know XMLLecture 1 - Getting to know XML
Lecture 1 - Getting to know XML
 
Lecture 4 - Adding XTHML for the Web
Lecture  4 - Adding XTHML for the WebLecture  4 - Adding XTHML for the Web
Lecture 4 - Adding XTHML for the Web
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Session 4 Tp4

  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. Rules for Conversational State Storage Converted to Memory freed Bit - blob Conversational state of a bean Written to storage in case of passivation Read from storage into memory in case of activation Converted into data from bit-blob
  • 8. Passivation of a Stateful Bean Client EJB Object Enterprise bean Other Enterprise beans Storage 1. Invoke business methods 5. Store passivated bean state The EJB Container/Server 2. Take the least recently used bean 3. Call ejbPassivate() 4. Serialize the bean state
  • 9. Activation of a Stateful Bean Enterprise Beans EJB Object Other Enterprise Beans Storage Client EJB Container/Server 3. Reconstruct bean 4. Call ejbActivate() 5. Invoke business method 1. Invoke business methods 2. Retrieve the passivated state of bean
  • 10.
  • 11. The Remote Interface Client Stateful Session Bean Class 1. number() { / Implementation } Remote Interface (Defines business methods of bean) 1. number() Number extends EJBObject
  • 12. The Bean Class Stateful Session Bean Class public int number(){ /* Actual Implementation*/ } public class Numberbean implements SessionBean private SessionContext ctx; public int answer; public void ejbCreate(int answer) throws CreateException public void ejbRemove() public void ejbActivate() public void ejbPassivate() public void setSessionContext(SessionContext ctx)
  • 13. The Home Interface import javax.ejb.*; import java.rmi.*;     public interface Numberhome extends EJBHome {   Number create( int answer ) throws RemoteException, CreateException ;     }
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.