Entity Bean Chuyên đề Lập trình Java & J2EE Chương 15

Slides:



Advertisements
Similar presentations
J0 1 Marco Ronchetti - Basi di Dati Web e Distribuite – Laurea Specialistica in Informatica – Università di Trento.
Advertisements

12 Copyright © 2005, Oracle. All rights reserved. Implementing Business Tasks with Session EJBs.
11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
EJB Entity Beans. Entity Beans Data versus logic Used to represent an instance rather than a collection of data (depending on underlying storage) Represents.
6/1/20151 Luca Simone Software Engineering 2 a.a. 2001/2002.
1 Softsmith Open Learning - EJB 21-Nov Enterprise Java Beans Introduction –Application ServerApplication Server –Java 2 Enterprise EditionJava.
Container Managed Persistence. General Guidelines Home and Remote interfaces are implemented the same as for bean managed persistence Entity Bean class.
Enterprise JavaBeans 2.0 Wu Lu (Cont’d). EJB2.0 Query Language EJB QL is a declarative language similar in many respects to SQL Is intended to be portable.
Introduction to Enterprise JavaBeans. Integrating Software Development Server-side Component Model Distributed Object Architecture –CORBA –DCOM –Java.
Enterprise Java Beans Welcome to the world of “Distributed System” Presented By: Sameer Nanda Date: 12/17/03.
Copyright W. Howden1 Lecture 19: Intro to O/O Components.
Emmanuel Cecchet et al.  Performance Scalability of J2EE application servers.  Test effect of: ◦ Application Implementation Methods ◦ Container Design.
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 J2EE Components. 2 Application Servers relieve the programming burden for business distributed components. They provide support for system level services.
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)
EJB Enterprise Java Bean.
EJB.
Writing Enterprise Applications with J2EE (Second lesson) Alessio Bechini June 2002 (based on material by Monica Pawlan)
Entity Beans BMP Celsina Bignoli
Middleware Technology (J2EE/EJB) Entity Bean. 2 Introduction to Entity Beans Persistence Concepts Entity beans are persistent objects that can be stored.
Lecture 8 Advanced Topics in Enterprise JavaBeans.
Entity Java Beans Jorg Janke Open Source ERP & CRM.
Container-Managed Persistence (CMP) Entity Beans Lesson 3A / Slide 1 of 42J2EE Server Components Objectives In this lesson, you will learn to: Identify.
Distributed Systems 1 Master of Information System Management Distributed Systems Persistence.
Enterprise Java Beans Part II Kyungmin Cho 2001/04/13.
Enterprise Java Bean Matt. 2 J2EE 3 J2EE Overview.
The Triad of Beans I Oleh: Dini Addiati ( ) Fahrurrozi Rahman ( Y) Irfan Hilmy ( ) Salman Azis A ( ) Aziiz Surahman.
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.
Introduction to J2EE Architecture Portions by Kunal Mehta.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
Message-Driven Beans and EJB Security Lesson 4B / Slide 1 of 37 J2EE Server Components Objectives In this lesson, you will learn about: Identify features.
Enterprise JavaBeans Understanding EJB Components Version 0.1 Kamal Wickramanayake
© 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.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
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.
13 Copyright © 2004, Oracle. All rights reserved. Managing Persistent Data in the Business Tier Entity EJBs.
©NIIT Introducing Enterprise JavaBeans (EJB) Lesson 1A / Slide 1 of 43J2EE Server Components Objectives In this lesson, you will learn about: The features.
Enterprise JavaBeans: Fundamentals. EJB Fundamentals(c)CDAC(Formerly NCST)2 Contents Introduction Technology Overview EJB Architecture EJB Specification.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Middleware Technology (J2EE/EJB) EJB Fundamentals.
EJB Enterprise Java Beans JAVA Enterprise Edition
14 Copyright © 2004, Oracle. All rights reserved. Achieving State Management in the Business Tier.
©NIIT Session Beans Lesson 1B/ Slide 1 of 37J2EE Server Components Objectives In this lesson, you will learn to: Describe the characteristics of session.
Introduction to J2EE Architecture
Structure of Enterprise Java Beans
Distributed System Using Java 2 Enterprise Edition (J2EE)
Understanding and Designing with EJB
Luca Simone Software Engineering 2 a.a. 2001/2002
Objectives In this lesson, you will learn to:
Understanding and Designing with EJB
Enterprise Java Beans Bina Ramamurthy 1/13/2019 B.Ramamurthy.
Entity Beans B.Ramamurthy 2/17/2019 BR.
Knowledge Byte In this section, you will learn about:
Component-based Applications
Understanding and Designing with EJB
Enterprise Java Beans Bina Ramamurthy 4/5/2019 B.Ramamurthy.
Enterprise Java Beans.
Knowledge Byte In this section, you will learn about:
Objectives In this lesson, you will learn about:
Presentation transcript:

Entity Bean Chuyên đề Lập trình Java & J2EE Chương 15 Biên soạn: Th.S Nguyễn văn Lành

Concepts An entity bean represents persistent data stored in one row of a database table . When an entity bean is created, the data is written to the appropriate database table row, and if the data in an entity bean is updated, the data in the appropriate database table row is also updated Entity beans differ from session beans in several ways. Entity beans are persistent: entity bean's state exists beyond the lifetime of the application allow shared access: may be shared by multiple clients have primary keys: unique object identifier may participate in relationships with other entity beans

When to Use Entity Beans The bean represents a business entity, not a procedure. For example, CreditCardEJB would be an entity bean CreditCardVerifierEJB would be a session bean. The bean's state must be persistent

Types of persistent management Bean-Managed Persistence the bean developer takes responsibility for persistent storage in attributes Container-Managed Persistence 1.1 persistent attributes are defined as attributes of the bean class and given in the deployment descriptor Container-Managed Persistence 2.0/2.1 The bean developer works with an abstract bean class defines abstract access methods for reading and writing of attributes (During deployment the EJB container generates a derived class that implements all the abstract methods )

Constitution of a entity bean Remote interface: defines the business methods of the bean. Home interface: defines the methods that allow a client to create and find an entity bean Enterprise Bean class: provides the implementation for the business methods, finder methods, home methods Primary key class makes it possible to identify all entity bean identities uniquely Deployment Descriptor: This configuration document defines the bean's runtime attributes, such as its transaction or security attributes Helper classes

Remote Interface Each method in the remote interface must match a method in the enterprise bean class. The signatures of the methods in the remote interface must be identical to the signatures of the corresponding methods in the enterprise bean class. The arguments and return values must be valid RMI types. The throws clause must include java.rmi.RemoteException

Home Interface defines the methods that allow a client to create and find an entity bean create Method has the same number and types of arguments as its matching ejbCreate method in the enterprise bean class. returns the remote interface type of the enterprise bean. The throws clause includes the exceptions specified by the throws clause of the corresponding ejbCreate and ejbPostCreate methods. The throws clause includes the javax.ejb.CreateException & java.rmi.RemoteException

Entity bean creation

Home Interface finder Method Every finder method in the home interface corresponds to a finder method in the entity bean class. The name of a finder method in the home interface begins with find, whereas the corresponding name in the entity bean class begins with ejbFind The number and types of arguments must match those of the corresponding method in the entity bean class. The return type is the entity bean's remote interface type, or a collection of those types. The exceptions in the throws clause include those of the corresponding method in the entity bean class. The throws clause contains the javax.ejb.FinderException & java.rmi.RemoteException

Home Interface finder Method in bean class All finder methods must begin with ejbFind. You must have at least one finder method, called ejbFindByPrimaryKey. You can have many different finder methods, each with different names and different parameters. A finder method must return either the primary key for the entity bean it finds or a collection of primary keys if it finds more than one.

Home Interface home Method Each home method definition in the home interface corresponds to a method in the entity bean class. In the home interface, the method name is arbitrary, provided that it does not begin with create or find. In the bean class, the matching method name begins with ejbHome. For example, in the SavingsAccountBean class the name is ejbHomeChargeForLowBalance, but in the SavingsAccountHome interface the name is chargeForLowBalance The throws clause contains the java.rmi.RemoteException

BMP guidelines

BMP guidelines

BMP guidelines

BMP guidelines

Bean-DBMS synchronization

CMP Entity Beans CMP Entity Beans Are Subclassed database-independent The container generates the JDBC code by subclassing your entity bean class. CMP Entity Beans Have No Declared Fields CMP Entity Beans Have a Query Language CMP Entity Beans Can Have ejbSelect() Methods

Bean instance Pooling

CMP Guidelines

CMP Guidelines

CMP Guidelines