1 EJB 3.0: There’s Something Different About You Martin Jäkle, TSBU Middleware.

Slides:



Advertisements
Similar presentations
12 Copyright © 2005, Oracle. All rights reserved. Implementing Business Tasks with Session EJBs.
Advertisements

Technische universität dortmund Service Computing Service Computing Prof. Dr. Ramin Yahyapour IT & Medien Centrum 12. November 2009.
Development and Deployment Roles Venugopal Pakanati.
Enterprise JavaBeans Ruslana Svidzinska CSE690. What is EJB? l An EJB is a specialized, non-visual JavaBean that runs on a server. l EJB technology supports.
Enterprise Java Beans Adam, Engels, Josh, Marc, Tim.
Writing Enterprise Applications with J2EE (Third lesson) Alessio Bechini June 2002 (based on material by Monica Pawlan)
SEI/CBS Initiative Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Sponsored by the U.S. Department of Defense © 1999.
Object Oriented Analysis and Design 1 Chapter 8 - Web Application System Design  Modeling Web Application using UML  Application Server  Web Application.
CSE446 S OFTWARE Q UALITY M ANAGEMENT Spring 2014 Yazılım ve Uyguluma Geliştirme Yöneticisi Orhan Başar Evren.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
EJB. Component Characteristics An enterprise Bean typically contains business logic that operates on the enterprise’s data. An enterprise Bean’s instances.
Brad Rippe Fullerton College. What you need to get started? JDK 1.3 standard for compilation J2EE - SDK1.2.1 App Server - An EJB Container/Web Container.
1 Session Bean Chuyên đề Lập trình Java & J2EE Chương 14 Biên soạn: Th.S Nguyễn văn Lành.
J2EE Part 2: Enterprise JavaBeans CSCI 4300 Images and code samples from jGuru EJB tutorial,
Enterprise Java Beans - (EJB)
Seminar: Enterprise JavaBeans. Agenda Agenda Java™ 2 Platform Java™ 2 Platform Java™ 2 Platform,Enterprise Edition(J2EE) Java™ 2 Platform,Enterprise Edition(J2EE)
Distributed Object-Oriented Programming (3) – Enterprise JavaBeans SNU iDB Lab. Taewhi Lee May 14th, 2007.
Entity Beans BMP Celsina Bignoli
Enterprise JavaBeans Umer Farooq CS6704: Design Patterns & Component FrameworksFebruary 25, 2002.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 6 Session Beans.
Distributed Systems 1 Master of Information System Management Distributed Systems Persistence.
Enterprise Java Beans Part II Kyungmin Cho 2001/04/13.
Presented By Pradeep K Sahu. What will be the Contents of the Seminar ? What is EJB ? EJB Architecture Types of EJB Session Entity Why EJB ? Writing a.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Enterprise JavaBeans. What is EJB? l An EJB is a specialized, non-visual JavaBean that runs on a server. l EJB technology supports application development.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
Enterprise Java Bean Computer Networks Natawut Nupairoj, Ph.D. Department of Computer Engineering Chulalongkorn University.
1 Introduction to J2EE CS : Software Design Winter /T13 Based on: Advanced Web Applications Development, cs © Eliezer Dekel, Sara.
JBoss Seam Presented by Andy Nguyen Truc Pham. What is JBoss Seam? Created by Gavin King Created by Gavin King A lightweight framework for Java EE 5.0.
Session Beans Objectives Introduction to Session Beans Local and Remote Session Beans Stateless and Stateful Session Beans Session Bean Lifecycle Accessing.
Session Beans -) stateless -) stateful. Session Beans A session bean represents a single client inside the J2EE server. To access an application that.
A TUTORIAL TO USING EJBs by SHREERAM IYER 09/17/2001.
Professional Open Source © JBoss Group, October 2015 EJB 3.0 Ease of use.
Enterprise JavaBeans Understanding EJB Components Version 0.1 Kamal Wickramanayake
1 Session Beans and Business Logic Presented By: Sethu Ram Kettimuthu.
© jGuru.com Enterprise JavaBeans Fundamentals.
Creating competitive advantage Copyright © 2003 Enterprise Java Beans Presenter: Wickramanayake HMKSK Version:0.1 Last Updated:
EJB Overview: Constraint Types and Enforcement in JBoss Elissa Newman Fluid Meeting 6/3/04.
Entity Beans & Persistence Chris Alexander CS 486 Spring 2001.
Enterprise Java Bean Technology Briefing Markus Hebach.
Session Beans Based on: Patel, Brose, Silverman, Mastering Enterprise JavaBeans 3.0.
Java Persistence API part 1 INFORMATICS ENGINEERING – UNIVERSITY OF BRAWIJAYA Eriq Muhammad Adams J
Session Beans Objectives Introduction to Session Beans Local and Remote Session Beans Stateless and Stateful Session Beans Session Bean Lifecycle Accessing.
Enterprise Java Beans N.V.RAJASEKHAR REDDY. Definition of EJB EJBs are the components that are the set of classes and interfaces deployed within a container.
Copyright © 2002 ProsoftTraining. All rights reserved. Enterprise JavaBeans.
Enterprise Java Beans Ye Zhou CS6704 Presentation Virginia Tech.
13 Copyright © 2004, Oracle. All rights reserved. Managing Persistent Data in the Business Tier Entity EJBs.
Enterprise JavaBeans: Fundamentals. EJB Fundamentals(c)CDAC(Formerly NCST)2 Contents Introduction Technology Overview EJB Architecture EJB Specification.
D Copyright © 2004, Oracle. All rights reserved. BMP Entity EJBs J2EE Connector Architecture.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Middleware Technology (J2EE/EJB) EJB Fundamentals.
Advanced Java Session 7 New York University School of Continuing and Professional Studies.
Enterprise JavaBeans™ Trademark of Sun Microsystems, Inc.
Session Beans & Business Logic CS 486 Sagar Deshpande.
14 Copyright © 2004, Oracle. All rights reserved. Achieving State Management in the Business Tier.
JAVA & J2EE UNIT – 8 ENTERPRISE JAVA BEAN - EJB 28-Jun-16 Prepared by: SANTHIYA.M & GANGA V. C. Department: Computer Science & Engineering Course code:
©NIIT Session Beans Lesson 1B/ Slide 1 of 37J2EE Server Components Objectives In this lesson, you will learn to: Describe the characteristics of session.
Advanced Java Programming
“Controlling your application” (the business logic)
Ruslana Svidzinska CSE690
Structure of Enterprise Java Beans
Objectives In this lesson, you will learn to:
Enterprise Java Beans Bina Ramamurthy 1/13/2019 B.Ramamurthy.
Knowledge Byte In this section, you will learn about:
Understanding and Designing with EJB
Enterprise Java Beans Bina Ramamurthy 4/5/2019 B.Ramamurthy.
Introduction to Session beans
Knowledge Byte In this section, you will learn about:
Objectives In this lesson, you will learn about:
Enterprise Java Beans.
Presentation transcript:

1 EJB 3.0: There’s Something Different About You Martin Jäkle, TSBU Middleware

2 Ease of Development Goal  Simplify EJB — make it easier to use – Simplified set of APIs – Eliminate deployment descriptor from developer's view – Facilitate test-driven development – Improve developer productivity  Capture broader range of developers – Make it simpler for average developer – Increase developer base, target more corporate developers

3 EJB 2.1 Session Bean import javax.ejb.EJBObject; import java.rmi.RemoteException; public interface Cart extends EJBObject { public void add(String item) throws RemoteException; public Collection getItems() throws RemoteException; public void completeOrder() throws RemoteException; } import javax.ejb.*; import java.rmi.RemoteException; public interface CartHome extends EJBHome { public Cart create() throws CreateException, RemoteException; }

4 EJB 2.1 Session Bean Class import javax.ejb.*; public class CartEJB implements SessionBean { protected Collection items = new ArrayList(); public void add(String item) { items.add(item); } public Collection getItems() { return items; } public void completeOrder(){.. } public void ejbCreate(){} public void ejbRemove(){} public void ejbActivate(){} public void ejbPassivate(){} public void setSessionContext(SessionContext context){} }

5 EJB 2.1 Deployment Descriptor Shopping Cart MyCart CartHome Cart CartEJB Stateful Container … … Required

6 EJB 3.0 Session Bean public interface Cart { public void add(String item); public Collection getItems(); public void completeOrder(); }

7 EJB 3.0 Session public interface Cart { public void add(String item); public Collection getItems(); public void completeOrder(); }

8 EJB 3.0 Session Bean class import javax.ejb.*; public class CartBean implements Cart { private ArrayList items; public void add(String item) { items.add(item); } public Collection getItems() { return items; } public void completeOrder() {...} }

9 EJB 3.0 Session Bean class import public class CartBean implements Cart { private ArrayList items; public void add(String item) { items.add(item); } public Collection getItems() { return items; public void completeOrder() {...} }

10 Deployment Descriptor

11 Significant Simplifications  Eliminated requirement for Home Interface – Not needed for session beans  Business interface is a POJI – Don’t need to extend specific interface – Bean implements business interface – Bean can have more than one business interface – RemoteExceptions are removed from programmer and client view  Eliminated requirement for unnecessary callback methods – Removed requirement to implement javax.ejb.SessionBean

12 Simplified Access to Bean's Environment  Get JNDI APIs out of developer's view – Not at all a good “hello world” experience  Declarative expression of dependencies in metadata  Techniques/Mechanism – Container injection of resource entries, etc. – Simple programmatic lookup mechanisms  Different usages, both have their place – Very simple; facilitates testability (especially setter injection techniques) – More flexible; dynamic

13 public class MySessionBean public DataSource customerDB; public void myMethod (String myString){ try { Connection conn = customerDB.getConnection();... } catch (Exception ex) {...} }

14 With Setter public class MySessionBean { private DataSource public void setDataSource(DataSource myDB) { customerDB = myDB; } public void myMethod (String myString){... Connection conn = customerDB.getConnection();... }

15 EJB 3.0 Entity Bean public class Customer { private String name; private Account account; public String getName() { return name; } public void setName(String name) { this.name = name; } public Account getAccount() { return account; } public void setAccount(Account account) { this.account = account; }

16 EJB 3.0 Entity public class Customer { private String name; private Account public String getName() { return name; } public void setName(String name) { this.name = name; public Account getAccount() { return account; } public void setAccount(Account account) { this.account = account; }

17 EJB 2.1 Versus 3.0: Simplifying Complexity

18 Old Way > Local Bean BeanImpl > EnterpriseBeanPK > Bean HomeBeanDTO 0..* 0..1 > EJBObject > EJBHome Application Code (SB, Servlet, etc)

19 New Way EJB3Bean EntityManager Application Code (SB, Servlet, etc)

20 EntityManager public class CustomerAccessBean { private EntityManager void setEntityManager(EntityManager em){ this.em = em; } public void updateAccountAccess(String cust) { Customer c = em.find(Customer.class, cust); c.getAccount().setLastAccessTime(); }

21 Named name= “findCustomersByName”, queryString= “SELECT c FROM Customer c” + “WHERE c.name LIKE :custName” public EntityManager em;... List customers = em.createNamedQuery(“findCustomersByName”).setParameter(“custName”, “Smith”).listResults();

22 Flexibility and Performance  Flexibility and performance are not being ignored for ease of development – O/R Mapping  Custom type mappings, inheritance … – EJB QL Enhancements  Sub queries, bulk operations, group-by … – Named queries, direct SQL, dynamic queries – Eager and lazy relationship fetching – Optimistic locking – version & timestamp

23 Oracle Support of EJB 3.0  Primary contributor (Mike Keith) on JSR 220 Expert Group  Released EJB 3.0 preview in March – Includes Entity Test Harness for out-of-container testing  Leading EJB 3.0 Eclipse project  Today Oracle TopLink supports both POJO and EJB 2.1 and 3.0 – Provides seamless path to EJB 3.0  Substantial EJB 3.0 functionality in production release – 2 nd half 2005 – Usable in JDK 1.4 with XML descriptors

24 Summary EJB 3.0 significantly improves ease of development It is real and can be used today Is the direction for Java persistence Based on proven technology Get a preview and try it out yourself!