150 likes | 425 Views
Enterprise JavaBeans. By Yung-Chien Chen. Topics. What is Enterprise JavaBeans Three Types of Enterprise JavaBeans Benefits. What is Enterprise JavaBeans (EJB). EJB is a part of the Java 2 Platform, Enterprise Edition (J2EE) Distributed Objects Server-side software components.
E N D
Enterprise JavaBeans By Yung-Chien Chen
Topics • What is Enterprise JavaBeans • Three Types of Enterprise JavaBeans • Benefits
What is Enterprise JavaBeans (EJB) • EJB is a part of the Java 2 Platform, Enterprise Edition (J2EE) • Distributed Objects • Server-side software components
J2EE Application Server API Stack • EJB – Enterprise Java Beans • RMI and RMI-IIOP • JNDI – Java Naming and Directory Interface • JDBC – Java Database Connectivity • JTA – Java Transaction API • JMS – Java Messaging Service • Java Servlets • JSP – Java Server Pages • Java IDL • JavaMail • JCA – Java Connector Architecture • JAXP – Java API for XML Parsing • JAAS – Java Authentication and Authorization Service
Three Types of EJB • Session Beans • Actions by remote method invocation • Entity Beans • Data Objects • Message-Driven Beans • Actions by messaging
Entity Beans Session Beans Account id=0 Amount=100 FindAccount Deposit Withdraw Transfer Account id=1 Amount=200 Database Employee id=0 Position=CEO FindEmployee Promote Transfer Employee id=1 Position=Manager
Session Bean Types • Stateful • Functions that require multiple requests • Stateless • Functions that can be complete with one request
Two Ways to Persist Entity Beans • Bean-Managed Persistence • developer writes code to perform persistent operations • Container-Managed Persistence • EJB Container generates data access code base on deployment descriptor • Harder to debug
Message Domains • Publish/subscribe • Point-to-Point Producer 1 Consumer 1 Topic Producer 2 Consumer 2 Producer 1 Queue Consumer 1 Producer 2
Components of a EJB • Bean class • Remote Interface • Home Interface • Local Interface • Local Home Interface • Deployment Descriptor • Vendor-Specific File
Benefits • Heterogeneity • Openness • Security • Scalability • Clustering • Redundancy • Failover • Transparency • Transaction