Life Cycle of an Entity Bean

Size: px
Start display at page:

Download "Life Cycle of an Entity Bean"

Transcription

1 Entity Bean An entity bean represents a business object by a persistent database table instead of representing a client. Students, teachers, and courses are some examples of entity beans. Each entity bean has an underlying table in the database and each instance of the bean is stored in a row of the table. An entity bean does not correspond to any specific client. It provides shared entities for clients. It is supported by the EJB transaction service via its container. It has a persistent state with a unique primary key identifier which can be used by a client to locate a particular entity bean.

2 Overview (cont.) Clients look up an existing entity bean by its primary key that is implemented by finding a row in its corresponding data table. A session bean does not have any primary identifier so that it does not have any findxxx() methods. Just like a session bean, any entity bean also has two interfaces and one implementation bean class. There are two types of entity beans: Bean Managed Persistence (BMP) entity beans and Container Managed Persistence (CMP) entity beans.

3 Life Cycle of an Entity Bean Since BMP and CMP have very similar life cycle we will not discuss the life cycle of CMP and BMP entity bean separately. BMP developers have full controls over database access but for CMP the EJB container takes care of it. For example in BMP, the insertion of a row to the table for an new instance of BMP is specified in the ejbcreate() method; the removal of an BMP object is done by deleting a row in its table specified in the ejbremove() method; the synchronization of BMP with its database table is specified in ejbload() and ejbstore()methods; the searching for a entity bean is specified in the ejbfindxxx() methods. In other word, EJB developers must know JDBC very well. For CMP, EJB developers don t need to know the detailed JDBC implementations.

4 Life Cycle of an Entity Bean

5 BMP Entity Bean BMP is a better choice in some applications, JDBC proficient entity bean developers feel more comfortable to take over the responsibility of managing the EJB persistence by themselves in the sense of flexibility or other reasons. An entity bean with BMP must perform JDBC storing data code to store the bean to its persistent storage and loading data code to load the bean from its persistent storage, and insert and delete operation as well. The life cycle of a BMP entity bean is introduced in the section of entity bean life cycle. When a business method is called on a BMP bean, the ejbactivate() is called first, followed by ejbload() method where the developer must load the persistent data to synchronize the bean with its data table, then the business method is invoked. The ejbload() and ejbstore() methods should be specified by EJB developers to guarantee the synchronization before a bean moves to its inactive stage.

6 Your First BMP Entity Bean Here is an example of a student BMP entity bean. It stores pairs of student-id and student- GPA. A database table for this bean must be created by the following SQL statement: CREATE TABLE student (id VARCHAR(3) CONSTRAINT pk_student PRIMARY KEY, score Number(1,0) );

7 Your First BMP Entity Bean (cont.) //The following is the home interface for this student //BMP entity bean. import javax.ejb.*; import java.util.*; public interface StudentHome extends EJBHome { public Student create(string id, double gpa) throws RemoteException, CreateException; public Account findbyprimarykey(string id) throws FinderException, RemoteException;

8 Your First BMP Entity Bean (cont.) //The following code is the remote interface for this //student BMP entity bean. import javax.ejb.ejbobject; import java.rmi.remoteexception; public interface Student extends EJBObject { public double getscore() throws RemoteException; //The following is the BMP implementation entity bean //where SQL statements are explicitly included.

9 Your First BMP Entity Bean (cont.) import java.sql.*; import javax.sql.*; import java.util.*; import javax.ejb.*; import javax.naming.*; public class StudentEJB implements EntityBean { private String id; private double score; private EntityContext context; private Connection con; private String dbname = "java:comp/env/jdbc/studentdb"; public double getscore() { return score;

10 Your First BMP Entity Bean (cont.) //The following ejb callback methods are executed by EJB //container. When a new bean instance is created the //method ejbcreate() is automatically called by the //container to insert a row in a corresponding table //in the database. public String ejbcreate(string id, double gpa) throws CreateException { try { insertrow(id, score); catch (Exception ex) { throw new EJBException("ejbCreate: "); this.id = id; this.score = score; return id;

11 Your First BMP Entity Bean (cont.) public String ejbfindbyprimarykey(string primarykey) throws FinderException { try { Boolean result = selectbyprimarykey(primarykey); catch (Exception ex) { throw new EJBException("ejbFindByPrimaryKey: "); if (result) { return primarykey; else { throw new ObjectNotFoundException ("Row for id " + primarykey + " not found.");

12 Your First BMP Entity Bean (cont.) public void ejbremove() { try { deleterow(id); catch (Exception ex) { throw new EJBException("ejbRemove: "); public void setentitycontext(entitycontext context) { this.context = context; try { makeconnection(); catch (Exception ex) { throw new EJBException( "Failed to connect to database. );

13 Your First BMP Entity Bean (cont.) public void ejbactivate() { id = (String)context.getPrimaryKey(); public void ejbpassivate() { id = null; public void ejbload() { try { loadrow(); catch (Exception ex) { throw new EJBException("ejbLoad: ");

14 Your First BMP Entity Bean (cont.) public void ejbstore() { try { storerow(); catch (Exception ex) { throw new EJBException("ejbLoad: " ); public void ejbpostcreate(string id, double score) { void makeconnection() throws NamingException, SQLException { InitialContext ic = new InitialContext(); DataSource ds = (DataSource) ic.lookup(dbname); con = ds.getconnection();

15 Your First BMP Entity Bean (cont.) //The following methods are callback methods to invoke //SQL statements to access database void insertrow (String id, double gpa) throws SQLException { String insertstatement = "insert into student values (?,?)"; PreparedStatement prepstmt = con.preparestatement(insertstatement); prepstmt.setstring(1, id); prepstmt.setdouble(2, gpa); prepstmt.executeupdate(); prepstmt.close();

16 Your First BMP Entity Bean (cont.) void deleterow(string id) throws SQLException { String deletestatement = "delete from student where id =? "; PreparedStatement prepstmt = con.preparestatement(deletestatement); prepstmt.setstring(1, id); prepstmt.executeupdate(); prepstmt.close(); boolean selectbyprimarykey(string primarykey) throws SQLException { String selectstatement="select id "+ "from student where id =? "; PreparedStatement prepstmt = con.preparestatement(selectstatement); prepstmt.setstring(1, primarykey); ResultSet rs = prepstmt.executequery(); boolean result = rs.next(); prepstmt.close(); return result;

17 Your First BMP Entity Bean (cont.) void loadrow() throws SQLException { String selectstatement = "select score " + "from student where id =? "; PreparedStatement prepstmt = con.preparestatement(selectstatement); prepstmt.setstring(1, this.id); ResultSet rs = prepstmt.executequery(); if (rs.next()) { this.score = rs.getdouble(2); prepstmt.close(); else { prepstmt.close(); throw new NoSuchEntityException(id + " not found.");

18 Your First BMP Entity Bean (cont.) void storerow() throws SQLException { String updatestatement = "update student set score =? " + "where id =?"; PreparedStatement prepstmt = con.preparestatement(updatestatement); prepstmt.setdouble(1, score); prepstmt.setstring(2, id); int rowcount = prepstmt.executeupdate(); prepstmt.close(); if (rowcount == 0) { throw new EJBException("Store id " + id + " failed.");

19 CMP Entity Bean For these entity bean developers without much JDBC experiences, the CMP is a better and easier choice since bean deployers can help to take care of persistence management. Generally, CMP is a prefer choice over BMP due to its high performance, database independence, and easy development and deployment. An entity bean with CMP relies on the EJB container to perform all database operations which are specified in the deployment descriptor. CMP is simpler than BMP in term of programming coding but CMP requires deployment administrator to do the configuration works. For the life cycle of CMP, developers don t need to do anything with ejbload() and ejbstore() since the synchronization is taken care of by EJB container itself.

20 Your first CMP Bean This simple CMP bean application demonstrates a company department and employee management with a department CMP entity bean named dept and an employee CMP entity bean named emp, and a CMR one to many relationship between dept entity bean and emp entity bean. For any department there may be zero (some department may be just established without any employee) or many employee; for each employee there must be one and only one department this employee works for. This diagram shows the relationship between these two entity beans. The relationship between dept and emp CMP entity beans

21 Your first CMP Bean (cont.) The LocalDeptHome.java specifies the Local home interface for dept CMP bean. A local interface is intended to be used by a local client at same server. package company; import java.util.*; import javax.ejb.*; public interface LocalDeptHome extends EJBLocalHome { public LocalCustomer create (String deptid, String deptloc ) throws CreateException; public LocalCustomer findbyprimarykey (deptid) throws FinderException;

22 Your first CMP Bean (cont.) The LocalDept.java specifies the Local object interface for dept CMP bean. A local interface is intended to be used by a local client at same server. package company; import java.util.*; import javax.ejb.*; public interface LocalDept extends EJBLocalObject { public String getdeptid(); public String getdeptloc(); public Vector getemp(); public void addemp (LocalEmp emp);

23 Your first CMP Bean (cont.) The DeptBean.java implements two above interface of this dept CMP bean. The getdeptid() and setdeptid(), getdeptloc()and setdeptloc() imply that this CMP bean has two CMP property fields: DeptID and DeptLoc. The getemp() and addemp() are used for the CMR relationship field between dept and emp. package company; import java.util.*; import javax.ejb.*;

24 Your first CMP Bean (cont.) public abstract class DeptBean implements EntityBean { private EntityContext context; // cmp fields: pmk and other fields, all abstract public abstract String gedeptid(); public abstract void setdeptid(string id); public abstract String getdeptloc(); public abstract void setdeptloc(string loc); //cmr fields: 1:n relationship from dept to emp, //all abstract methods public abstract Collection getemp(); public abstract void setemp (Collection emp);

25 Your first CMP Bean (cont.) //business methods public Vector getemp() { Vector v = new Vector(); Iterator i = getemp().iterator(); while (i.hasnext()) { v.add((localemp)i.next()); return v; public void addemp (LocalEmp emp) { getemp().add(emp);

26 Your first CMP Bean (cont.) private String create(string id, String loc) throws CreateException { setdeptid(id); setdeptloc(loc); return id; public String ejbcreate (String id, String loc) throws CreateException { return create(id, loc); public void ejbpostcreate (String id, String loc) throws CreateException {

27 Your first CMP Bean (cont.) public void setentitycontext(entitycontext ctx) { public void unsetentitycontext() { public void ejbremove() { public void ejbload() { public void ejbstore() { public void ejbpassivate() { public void ejbactivate() {

28 Your first CMP Bean (cont.) The LocalEmpHome.java specifies the local home interface for the emp CMP entity bean. package company; import javax.ejb.*; public interface LocalEmpHome extends EJBLocalHome { public LocalEmp create ( String dpetid, String empid, String name, Float salary) throws CreateException; public LocalEmp findbyprimarykey(string empid) throws FinderException;

29 Your first CMP Bean (cont.) The LocalEmp.java specifies the local object interface for this emp CMP entity bean. package company; import javax.ejb.*; public interface LocalEmp extends EJBLocalObject{ public String getempid(); public String getname(); public float getsalary();

30 Your first CMP Bean (cont.) The EmpBean.java specifies the bean class implementation for this emp CMP entity bean. It indicates that this bean has three CMP property fields: empid, empname and Salary. package company; import java.util.*; import javax.ejb.*; import javax.naming.*; public abstract class EmpBean implements EntityBean { private EntityContext context; //for cmp fields: all abstract access methods public abstract String getempid(); public abstract void setempid(string id);

31 Your first CMP Bean (cont.) public abstract String getname(); public abstract void setname(string name); public abstract float getsalary(); public abstract void setsalary(float sal); public String ejbcreate(string did, String eid, String name, float sal) throws CreateException { return create (eid, name, sal); private String create( String id, String name, float sal) throws CreateException { setempid(id); setname(name); setsalary(sal); return id;

32 Your first CMP Bean (cont.) //Other EntityBean callback methods. Notice ejbpostcreate() // must add this new employee by dept.addemp() to make // sure each employee has one department to work for. public void ejbpostcreate(string did,string eid, String name, float sal) throws CreateException {postcreate(did); private void postcreate (String did) { try { Context ic = new InitialContext(); LocalCustomerHome home = (LocalDeptHome) ic.lookup("java:comp/env/ejb/deptref"); LocalDept dept = home.findbyprimarykey(did); dept.addemp((localemp)context.getejblocalobject());

33 Your first CMP Bean (cont.) catch (Exception ex) { context.setrollbackonly(); ex.printstacktrace(); public void setentitycontext(entitycontext ctx) { context = ctx; public void unsetentitycontext() { context = null; public void ejbremove() { public void ejbload() { public void ejbstore() { public void ejbpassivate() { public void ejbactivate() {

<<Interface>> EntityBean (from ejb) EJBHome. <<Interface>> CountHome. (from entity) create() findbyprimarykey() <<Interface>> EJBObject.

<<Interface>> EntityBean (from ejb) EJBHome. <<Interface>> CountHome. (from entity) create() findbyprimarykey() <<Interface>> EJBObject. Count BMP Entity EJB Count BMP Entity EJB EJBHome (from ejb) EntityBean (from ejb) CountClient main() CountHome create() findbyprimarykey() EJBObject (from ejb) Count getcurrentsum() setcurrentsum() increment()

More information

Lab2: CMP Entity Bean working with Session Bean

Lab2: CMP Entity Bean working with Session Bean Session Bean The session bean in the Lab1 uses JDBC connection to retrieve conference information from the backend database directly. The Lab2 extends the application in Lab1 and adds an new entity bean

More information

Enterprise JavaBeans. Layer:08. Persistence

Enterprise JavaBeans. Layer:08. Persistence Enterprise JavaBeans Layer:08 Persistence Agenda Discuss "finder" methods. Describe DataSource resources. Describe bean-managed persistence. Describe container-managed persistence. Last Revised: 11/1/2001

More information

JNDI. JNDI (Java Naming and Directory Interface) is used as a naming and directory service in J2EE/J2SE components.

JNDI. JNDI (Java Naming and Directory Interface) is used as a naming and directory service in J2EE/J2SE components. JNDI JNDI (Java Naming and Directory Interface) is used as a naming and directory service in J2EE/J2SE components. A Naming service is a service that provides a mechanism for giving names to objects so

More information

Enterprise JavaBeans. Layer:07. Entity

Enterprise JavaBeans. Layer:07. Entity Enterprise JavaBeans Layer:07 Entity Agenda Build entity beans. Describe the bean's lifecycle. Describe the server's free pool. Copyright (C) 2001 2 Entity Beans Purpose Entity beans represent business

More information

Lab3: A J2EE Application with Stateful Session Bean and CMP Entity Beans

Lab3: A J2EE Application with Stateful Session Bean and CMP Entity Beans Session Bean and CMP Entity Beans Based on the lab2, the lab3 implements an on line symposium registration application RegisterApp which consists of a front session bean and two CMP supported by database

More information

UNIT-III EJB APPLICATIONS

UNIT-III EJB APPLICATIONS UNIT-III EJB APPLICATIONS CONTENTS EJB Session Beans EJB entity beans EJB clients EJB Deployment Building an application with EJB. EJB Types Types of Enterprise Beans Session beans: Also called business

More information

Enterprise JavaBeans: BMP and CMP Entity Beans

Enterprise JavaBeans: BMP and CMP Entity Beans CIS 386 Course Advanced Enterprise Java Programming Enterprise JavaBeans: BMP and CMP Entity Beans René Doursat Guest Lecturer Golden Gate University, San Francisco February 2003 EJB Trail Session Beans

More information

Lab1: Stateless Session Bean for Registration Fee Calculation

Lab1: Stateless Session Bean for Registration Fee Calculation Registration Fee Calculation The Lab1 is a Web application of conference registration fee discount calculation. There may be sub-conferences for attendee to select. The registration fee varies for different

More information

JBuilder. Getting Started Guide part II. Preface. Creating your Second Enterprise JavaBean. Container Managed Persistent Bean.

JBuilder. Getting Started Guide part II. Preface. Creating your Second Enterprise JavaBean. Container Managed Persistent Bean. Getting Started Guide part II Creating your Second Enterprise JavaBean Container Managed Persistent Bean by Gerard van der Pol and Michael Faisst, Borland Preface Introduction This document provides an

More information

Conception of Information Systems Lecture 8: J2EE and EJBs

Conception of Information Systems Lecture 8: J2EE and EJBs Conception of Information Systems Lecture 8: J2EE and EJBs 3 May 2005 http://lsirwww.epfl.ch/courses/cis/2005ss/ 2004-2005, Karl Aberer & J.P. Martin-Flatin 1 1 Outline Components J2EE and Enterprise Java

More information

Copyright UTS Faculty of Information Technology 2002 EJB2 EJB-3. Use Design Patterns 1 to re-use well known programming techniques.

Copyright UTS Faculty of Information Technology 2002 EJB2 EJB-3. Use Design Patterns 1 to re-use well known programming techniques. Advanced Java Programming (J2EE) Enterprise Java Beans (EJB) Part 2 Entity & Message Beans Chris Wong chw@it.uts.edu.au (based on prior class notes & Sun J2EE tutorial) Enterprise Java Beans Last lesson

More information

Q: I just remembered that I read somewhere that enterprise beans don t support inheritance! What s that about?

Q: I just remembered that I read somewhere that enterprise beans don t support inheritance! What s that about? session beans there are no Dumb Questions Q: If it s so common to leave the methods empty, why don t they have adapter classes like they have for event handlers that implement all the methods from the

More information

Enterprise JavaBeans. Layer:03. Session

Enterprise JavaBeans. Layer:03. Session Enterprise JavaBeans Layer:03 Session Agenda Build stateless & stateful session beans. Describe the bean's lifecycle. Describe the server's swapping mechanism. Last Revised: 10/2/2001 Copyright (C) 2001

More information

Stateless Session Bean

Stateless Session Bean Session Beans As its name implies, a session bean is an interactive bean and its lifetime is during the session with a specific client. It is non-persistent. When a client terminates the session, the bean

More information

8. Component Software

8. Component Software 8. Component Software Overview 8.1 Component Frameworks: An Introduction 8.2 OSGi Component Framework 8.2.1 Component Model and Bundles 8.2.2 OSGi Container and Framework 8.2.3 Further Features of the

More information

Container Managed Persistent in EJB 2.0

Container Managed Persistent in EJB 2.0 Container Managed Persistent in EJB 2.0 A comprehensive explanation of the new CMP in EJB 2.0 (PFD 2) using the RI of SUN By Raphael Parree 2001 IT-DreamTeam Table of Contents INTRODUCTION 3 CMP IMPLEMENTATION

More information

Entity Beans 02/24/2004

Entity Beans 02/24/2004 Entity Beans 1 This session is about Entity beans. Understanding entity beans is very important. Yet, entity bean is a lot more complex beast than a session bean since it involves backend database. So

More information

Developing CMP 2.0 Entity Beans

Developing CMP 2.0 Entity Beans 863-5ch11.fm Page 292 Tuesday, March 12, 2002 2:59 PM Developing CMP 2.0 Entity Beans Topics in This Chapter Characteristics of CMP 2.0 Entity Beans Advantages of CMP Entity Beans over BMP Entity Beans

More information

Introducing EJB-CMP/CMR, Part 2 of 3

Introducing EJB-CMP/CMR, Part 2 of 3 Introducing EJB-CMP/CMR, Part 2 of 3 Table of Contents If you're viewing this document online, you can click any of the topics below to link directly to that section. 1. Introduction... 2 2. Application

More information

8. Component Software

8. Component Software 8. Component Software Overview 8.1 Component Frameworks: An Introduction 8.2 OSGi Component Framework 8.2.1 Component Model and Bundles 8.2.2 OSGi Container and Framework 8.2.3 Further Features of the

More information

Topexam. 一番権威的な IT 認定試験ウェブサイト 最も新たな国際 IT 認定試験問題集

Topexam.  一番権威的な IT 認定試験ウェブサイト 最も新たな国際 IT 認定試験問題集 Topexam 一番権威的な IT 認定試験ウェブサイト http://www.topexam.jp 最も新たな国際 IT 認定試験問題集 Exam : 1D0-442 Title : CIW EnterprISE SPECIALIST Vendors : CIW Version : DEMO Get Latest & Valid 1D0-442 Exam's Question and Answers

More information

J2EE Application Server. EJB Overview. Java versus.net for the Enterprise. Component-Based Software Engineering. ECE493-Topic 5 Winter 2007

J2EE Application Server. EJB Overview. Java versus.net for the Enterprise. Component-Based Software Engineering. ECE493-Topic 5 Winter 2007 Component-Based Software Engineering ECE493-Topic 5 Winter 2007 Lecture 24 Java Enterprise (Part B) Ladan Tahvildari Assistant Professor Dept. of Elect. & Comp. Eng. University of Waterloo J2EE Application

More information

Understanding and Designing with EJB

Understanding and Designing with EJB Understanding and Designing with EJB B.Ramamurthy Based on j2eetutorial documentation. http://java.sun.com/j2ee/tutorial/1_3-fcs/index.html 3/31/2003 1 Review Request/Response Model Distributed Objects:

More information

J2EE Access of Relational Data

J2EE Access of Relational Data J2EE Access of Relational Data Direct JDBC Direct SQL calls, uses rows and result sets directly Object view Accessed as objects or components, transparent that the data is stored in relational database

More information

Sharpen your pencil. entity bean synchronization

Sharpen your pencil. entity bean synchronization Using the interfaces below, write a legal bean class. You don t have to write the actual business logic, but at least list all the methods that you have to write in the class, with their correct declarations.

More information

Enterprise JavaBeans. Session EJBs

Enterprise JavaBeans. Session EJBs Enterprise JavaBeans Dan Harkey Client/Server Computing Program Director San Jose State University dharkey@email.sjsu.edu www.corbajava.engr.sjsu.edu Session EJBs Implement business logic that runs on

More information

Sharpen your pencil. Container services. EJB Object. the bean

Sharpen your pencil. Container services. EJB Object. the bean EJB architecture 1 Label the three parts in the diagram. Client B Container services server Client object biz interface A EJB Object C the bean DB 2 Describe (briefly) what each of the three things are

More information

5. Enterprise JavaBeans 5.4 Session Beans. Session beans

5. Enterprise JavaBeans 5.4 Session Beans. Session beans 5.4 Session Beans Session beans Exécutent des traitements métiers (calculs, accès BD, ) Peuvent accéder à des données dans la BD mais ne représentent pas directement ces données. Sont non persistants (short-lived)

More information

The Developer s Guide to Understanding Enterprise JavaBeans. Nova Laboratories

The Developer s Guide to Understanding Enterprise JavaBeans. Nova Laboratories The Developer s Guide to Understanding Enterprise JavaBeans Nova Laboratories www.nova-labs.com For more information about Nova Laboratories or the Developer Kitchen Series, or to add your name to our

More information

Transaction Commit Options

Transaction Commit Options Transaction Commit Options Entity beans in the EJB container of Borland Enterprise Server by Jonathan Weedon, Architect: Borland VisiBroker and Borland AppServer, and Krishnan Subramanian, Enterprise Consultant

More information

Simple Entity EJB - xdoclet, MyEclipse, Jboss and PostgreSql, MySql

Simple Entity EJB - xdoclet, MyEclipse, Jboss and PostgreSql, MySql Simple Entity EJB - xdoclet, MyEclipse, Jboss and PostgreSql, MySql Creation and testing of a first Entity Bean using MyEcplise, Jboss and xdoclet. General Author: Sebastian Hennebrüder http://www.laliluna.de/tutorial.html

More information

@jbossdeveloper. explained

@jbossdeveloper. explained @jbossdeveloper explained WHAT IS? A recommended approach, using modern technologies, that makes you more productive. Modern Technologies A Simple Process Build A Domain Layer Java EE 6 HTML5 by AeroGear

More information

Oracle8i. Enterprise JavaBeans Developer s Guide and Reference. Release 3 (8.1.7) July 2000 Part No. A

Oracle8i. Enterprise JavaBeans Developer s Guide and Reference. Release 3 (8.1.7) July 2000 Part No. A Oracle8i Enterprise JavaBeans Developer s Guide and Reference Release 3 (8.1.7) July 2000 Part No. A83725-01 Enterprise JavaBeans Developer s Guide and Reference, Release 3 (8.1.7) Part No. A83725-01 Release

More information

Enterprise Java Beans

Enterprise Java Beans Enterprise Java Beans Objectives Three Tiered Architecture Why EJB? What all we should know? EJB Fundamentals 2 Three Tiered Architecture Introduction Distributed three-tier design is needed for Increased

More information

Questions and Answers. A. A DataSource is the basic service for managing a set of JDBC drivers.

Questions and Answers. A. A DataSource is the basic service for managing a set of JDBC drivers. Q.1) What is, in terms of JDBC, a DataSource? A. A DataSource is the basic service for managing a set of JDBC drivers B. A DataSource is the Java representation of a physical data source C. A DataSource

More information

Introduction to Session beans EJB 3.0

Introduction to Session beans EJB 3.0 Introduction to Session beans EJB 3.0 Remote Interface EJB 2.1 ===================================================== public interface Hello extends javax.ejb.ejbobject { /** * The one method - hello -

More information

Persistence Options for Object-Oriented Programs

Persistence Options for Object-Oriented Programs Persistence Options for Object-Oriented Programs JAOO 2003 Wolfgang Keller, wk@objectarchitects.de Monday September 22nd, 2003. (15:15h - 16:00h) 2003 Wolfgang W. Keller - all rights reserved 1 Your Charter

More information

Enterprise JavaBeans 2.1

Enterprise JavaBeans 2.1 Enterprise JavaBeans 2.1 STEFAN DENNINGER and INGO PETERS with ROB CASTANEDA translated by David Kramer ApressTM Enterprise JavaBeans 2.1 Copyright c 2003 by Stefan Denninger and Ingo Peters with Rob Castaneda

More information

12) Enterprise Java Beans Basics. Obligatory Reading. Literature

12) Enterprise Java Beans Basics. Obligatory Reading. Literature Obligatory Reading 12) Enterprise Java Beans Prof. Dr. Uwe Aßmann Technische Universität Dresden Institut für Software- und Multimediatechnik http://st.inf.tu-dresden.de 11-0.1, May 19, 2010 1. Basics

More information

12) Enterprise Java Beans

12) Enterprise Java Beans 12) Enterprise Java Beans Prof. Dr. Uwe Aßmann Technische Universität Dresden Institut für Software- und Multimediatechnik http://st.inf.tu-dresden.de 13-1.0, May 3, 2013 1. Basics 2. Parts of the Bean

More information

12) Enterprise Java Beans

12) Enterprise Java Beans 12) Enterprise Java Beans Prof. Dr. Uwe Aßmann Technische Universität Dresden Institut für Software- und Multimediatechnik http://st.inf.tu-dresden.de 13-1.0, May 3, 2013 1. Basics 2. Parts of the Bean

More information

Oracle Containers for J2EE

Oracle Containers for J2EE Oracle Containers for J2EE Orion CMP Developer s Guide 10g Release 3 (10.1.3.1) B28220-01 September 2006 Oracle Containers for J2EE Orion CMP Developer s Guide, 10g Release 3 (10.1.3.1) B28220-01 Copyright

More information

12) Enterprise Java Beans

12) Enterprise Java Beans 12) Enterprise Java Beans Prof. Dr. Uwe Aßmann Technische Universität Dresden Institut für Software- und Multimediatechnik http://st.inf.tu-dresden.de 12-1.0, April 25, 2012 1. Basics 2. Different Kinds

More information

Efficient Object-Relational Mapping for JAVA and J2EE Applications or the impact of J2EE on RDB. Marc Stampfli Oracle Software (Switzerland) Ltd.

Efficient Object-Relational Mapping for JAVA and J2EE Applications or the impact of J2EE on RDB. Marc Stampfli Oracle Software (Switzerland) Ltd. Efficient Object-Relational Mapping for JAVA and J2EE Applications or the impact of J2EE on RDB Marc Stampfli Oracle Software (Switzerland) Ltd. Underestimation According to customers about 20-50% percent

More information

Enterprise Java Beans

Enterprise Java Beans Enterprise Java Beans Prof. Dr. Uwe Aßmann Technische Universität Dresden Institut für Software- und Multimediatechnik http://st.inf.tu-dresden.de 10-0.1, May 19, 2010 CBSE, Prof. Uwe Aßmann 1 Content

More information

Code generation with XDoclet. It s so beautifully arranged on the plate you know someone s fingers have been all over it.

Code generation with XDoclet. It s so beautifully arranged on the plate you know someone s fingers have been all over it. Code generation with XDoclet It s so beautifully arranged on the plate you know someone s fingers have been all over it. Julia Child 33 34 CHAPTER 2 Code generation with XDoclet Developing EJBs today entails

More information

EJB ENTERPRISE JAVA BEANS INTRODUCTION TO ENTERPRISE JAVA BEANS, JAVA'S SERVER SIDE COMPONENT TECHNOLOGY. EJB Enterprise Java

EJB ENTERPRISE JAVA BEANS INTRODUCTION TO ENTERPRISE JAVA BEANS, JAVA'S SERVER SIDE COMPONENT TECHNOLOGY. EJB Enterprise Java EJB Enterprise Java EJB Beans ENTERPRISE JAVA BEANS INTRODUCTION TO ENTERPRISE JAVA BEANS, JAVA'S SERVER SIDE COMPONENT TECHNOLOGY Peter R. Egli 1/23 Contents 1. What is a bean? 2. Why EJB? 3. Evolution

More information

Java Smart Ticket Demo Application Scrutinized

Java Smart Ticket Demo Application Scrutinized Java Smart Ticket Demo Application Scrutinized Dominik Gruntz and René Müller University of Applied Sciences, Aargau, Switzerland {d.gruntz, rene.mueller@fh-aargau.ch Abstract. For the Java component model

More information

CSC System Development with Java. Database Connection. Department of Statistics and Computer Science. Budditha Hettige

CSC System Development with Java. Database Connection. Department of Statistics and Computer Science. Budditha Hettige CSC 308 2.0 System Development with Java Database Connection Budditha Hettige Department of Statistics and Computer Science Budditha Hettige 1 From database to Java There are many brands of database: Microsoft

More information

The Details of Writing Enterprise Java Beans

The Details of Writing Enterprise Java Beans The Details of Writing Enterprise Java Beans Your Guide to the Fundamentals of Writing EJB Components P. O. Box 80049 Austin, TX 78708 Fax: +1 (801) 383-6152 information@middleware-company.com +1 (877)

More information

23. Enterprise Java Beans

23. Enterprise Java Beans Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie Prof. Aßmann - CBSE 23. Enterprise Java Beans Lecturer: Dr. Sebastian Götz Prof. Dr. Uwe Aßmann Technische Universität

More information

CSE 510 Web Data Engineering

CSE 510 Web Data Engineering CSE 510 Web Data Engineering Data Access Object (DAO) Java Design Pattern UB CSE 510 Web Data Engineering Data Access Object (DAO) Java Design Pattern A Data Access Object (DAO) is a bean encapsulating

More information

Acknowledgments About the Authors

Acknowledgments About the Authors Acknowledgments p. xi About the Authors p. xiii Introduction p. xv An Overview of MySQL p. 1 Why Use an RDBMS? p. 2 Multiuser Access p. 2 Storage Transparency p. 2 Transactions p. 3 Searching, Modifying,

More information

Session Bean. Disclaimer & Acknowledgments. Revision History. Sang Shin Jeff Cutler

Session Bean.  Disclaimer & Acknowledgments. Revision History. Sang Shin Jeff Cutler J2EE Programming with Passion! Session Bean Sang Shin sang.shin@sun.com Jeff Cutler jpcutler@yahoo.com 1 www.javapassion.com/j2ee 2 Disclaimer & Acknowledgments? Even though Sang Shin is a full-time employee

More information

CMP relations between Enterprise Java Beans (EJB) eclipse, xdoclet, jboss

CMP relations between Enterprise Java Beans (EJB) eclipse, xdoclet, jboss CMP relations between Enterprise Java Beans (EJB) eclipse, xdoclet, jboss A step by step example showing how to develop CMP relations between EJBs using eclipse, xdoclet and MyEclipse. We use an example

More information

Objectives. Software Development using MacroMedia s JRun. What are EJBs? Topics for Discussion. Examples of Session beans calling entity beans

Objectives. Software Development using MacroMedia s JRun. What are EJBs? Topics for Discussion. Examples of Session beans calling entity beans Software Development using MacroMedia s JRun B.Ramamurthy Objectives To study the components and working of an enterprise java bean (EJB). Understand the features offered by Jrun4 environment. To be able

More information

Oracle9iAS Containers for J2EE

Oracle9iAS Containers for J2EE Oracle9iAS Containers for J2EE Enterprise JavaBeans Developer s Guide Release 2 (9.0.4) Part No. B10324-01 April 2003 Beta Draft. Oracle9iAS Containers for J2EE Enterprise JavaBeans Developer s Guide,

More information

8. Component Software

8. Component Software 8. Component Software Overview 8.1 Component Frameworks: An Introduction 8.2 Microsoft s Component Object Model 8.2.1 Component Model 8.2.2 Component Infrastructure 8.2.3 Further Features of the COM Framework

More information

Java/J2EE Interview Questions(255 Questions)

Java/J2EE Interview Questions(255 Questions) Java/J2EE Interview Questions(255 Questions) We are providing the complete set of Java Interview Questions to the Java/J2EE Developers, which occurs frequently in the interview. Java:- 1)What is static

More information

Enterprise JavaBeans (I) K.P. Chow University of Hong Kong

Enterprise JavaBeans (I) K.P. Chow University of Hong Kong Enterprise JavaBeans (I) K.P. Chow University of Hong Kong JavaBeans Components are self contained, reusable software units that can be visually composed into composite components using visual builder

More information

This chapter describes: AssetBean AssetMgr AssetMgrEJB AssetMgrHome AssetTagAssociationBean AssetTypeBean AssociationBean AssociationMgr

This chapter describes: AssetBean AssetMgr AssetMgrEJB AssetMgrHome AssetTagAssociationBean AssetTypeBean AssociationBean AssociationMgr $VVHW9LVLELOLW\ 6HUYLFHV$3, 1 This chapter describes: AssetBean AssetMgr AssetMgrEJB AssetMgrHome AssetTagAssociationBean AssetTypeBean AssociationBean AssociationMgr AssociationMgrEJB AssociationMgrHome

More information

Persistence Options for Object-Oriented Programs

Persistence Options for Object-Oriented Programs Persistence Options for Object-Oriented Programs OOP 2004 Wolfgang Keller, wk@objectarchitects.de Wednesday, January 21st 2004. (15:30h - 17:00h) 2004 Wolfgang W. Keller - all rights reserved 0 Your Charter

More information

Entities are classes that need to be persisted, usually in a relational database. In this chapter we cover the following topics:

Entities are classes that need to be persisted, usually in a relational database. In this chapter we cover the following topics: Entities are classes that need to be persisted, usually in a relational database. In this chapter we cover the following topics: EJB 3 entities Java persistence API Mapping an entity to a database table

More information

BEA WebLogic Server. Enterprise JavaBeans

BEA WebLogic Server. Enterprise JavaBeans BEA WebLogic Server Enterprise JavaBeans Document 1.0 April 2000 Copyright Copyright 2000 BEA Systems, Inc. All Rights Reserved. Restricted Rights Legend This software and documentation is subject to

More information

SCBCD EXAM STUDY KIT. Paul Sanghera CX JAVA BUSINESS COMPONENT DEVELOPER CERTIFICATION FOR EJB MANNING. Covers all you need to pass

SCBCD EXAM STUDY KIT. Paul Sanghera CX JAVA BUSINESS COMPONENT DEVELOPER CERTIFICATION FOR EJB MANNING. Covers all you need to pass CX-310-090 SCBCD EXAM STUDY KIT JAVA BUSINESS COMPONENT DEVELOPER CERTIFICATION FOR EJB Covers all you need to pass Includes free download of a simulated exam You will use it even after passing the exam

More information

Enterprise JavaBeans TM

Enterprise JavaBeans TM Enterprise JavaBeans TM Linda DeMichiel Sun Microsystems, Inc. Agenda Quick introduction to EJB TM Major new features Support for web services Container-managed persistence Query language Support for messaging

More information

Oracle Developer Day Agenda

Oracle Developer Day Agenda Oracle er Day Agenda 9.00 am 9:55 am 10:45 am 11:35 am 12.20 pm 1.15 pm 2.00 pm 2.30 pm SOA & The Agile Enterprise ing Enterprise JavaBeans EJB 3.0 ing Web Services Integrating Services with BPEL Lunch

More information

access to a JCA connection in WebSphere Application Server

access to a JCA connection in WebSphere Application Server Understanding connection transitions: Avoiding multithreaded access to a JCA connection in WebSphere Application Server Anoop Ramachandra (anramach@in.ibm.com) Senior Staff Software Engineer IBM 09 May

More information

JAVA. Aspects (AOP) AspectJ

JAVA. Aspects (AOP) AspectJ JAVA Aspects (AOP) AspectJ AOP Aspect-oriented programming separation of concerns concern ~ a part of program code related to a particular functionality typically understood as an extension of OOP solves

More information

J2EE Web Development 13/1/ Application Servers. Application Servers. Agenda. In the beginning, there was darkness and cold.

J2EE Web Development 13/1/ Application Servers. Application Servers. Agenda. In the beginning, there was darkness and cold. 1. Application Servers J2EE Web Development In the beginning, there was darkness and cold. Then, mainframe terminals terminals Centralized, non-distributed Agenda Application servers What is J2EE? Main

More information

Chapter 6 Enterprise Java Beans

Chapter 6 Enterprise Java Beans Chapter 6 Enterprise Java Beans Overview of the EJB Architecture and J2EE platform The new specification of Java EJB 2.1 was released by Sun Microsystems Inc. in 2002. The EJB technology is widely used

More information

IBM WebSphere Application Server. J2EE Programming Model Best Practices

IBM WebSphere Application Server. J2EE Programming Model Best Practices IBM WebSphere Application Server J2EE Programming Model Best Practices Requirements Matrix There are four elements of the system requirements: business process and application flow dynamic and static aspects

More information

1 of 6 11/08/2011 10:14 AM 1. Introduction 1.1. Project/Component Working Name: SJSAS 9.1, Support for JDBC 4.0 in JDBC RA, RFEs 1.2. Name(s) and e-mail address of Document Author(s)/Supplier: Jagadish

More information

Using the Transaction Service

Using the Transaction Service 15 CHAPTER 15 Using the Transaction Service The Java EE platform provides several abstractions that simplify development of dependable transaction processing for applications. This chapter discusses Java

More information

these methods, remote clients can access the inventory services provided by the application.

these methods, remote clients can access the inventory services provided by the application. 666 ENTERPRISE BEANS 18 Enterprise Beans problems. The EJB container not the bean developer is responsible for system-level services such as transaction management and security authorization. Second, because

More information

ENTERPRISE beans are the J2EE components that implement Enterprise Java-

ENTERPRISE beans are the J2EE components that implement Enterprise Java- 18 Enterprise Beans ENTERPRISE beans are the J2EE components that implement Enterprise Java- Beans (EJB) technology. Enterprise beans run in the EJB container, a runtime environment within the J2EE server

More information

Virus Scan with SAP Process Integration Using Custom EJB Adapter Module

Virus Scan with SAP Process Integration Using Custom EJB Adapter Module Virus Scan with SAP Process Integration Using Custom EJB Adapter Module Applies to: SAP Process Integration 7.0 and Above Versions. Custom Adapter Module, Virus Scan Adapter Module, Virus Scan in SAP PI.

More information

1 Introduction. Craig E. Ward Page 1 7/3/05. Abstract

1 Introduction. Craig E. Ward Page 1 7/3/05. Abstract Implications of Java Data Objects for Database Application Architectures Craig E. Ward CMSI 698 SS:Advanced Topics in Database Systems Loyola Marymount University, Spring 2004 Abstract This paper surveys

More information

Enterprise Java Beans for the Oracle Internet Platform

Enterprise Java Beans for the Oracle Internet Platform Enterprise Java Beans for the Oracle Internet Platform Matthieu Devin, Rakesh Dhoopar, and Wendy Liau, Oracle Corporation Abstract Enterprise Java Beans is a server component model for Java that will dramatically

More information

EJB - ACCESS DATABASE

EJB - ACCESS DATABASE EJB - ACCESS DATABASE http://www.tutorialspoint.com/ejb/ejb_access_database.htm Copyright tutorialspoint.com EJB 3.0, persistence mechanism is used to access the database in which container manages the

More information

WAS V7 Application Development

WAS V7 Application Development IBM Software Group WAS V7 Application Development An IBM Proof of Technology Updated September 28, 2009 WAS v7 Programming Model Goals One word Simplify Simplify the programming model Simplify application

More information

Transaction and Persistence Patterns

Transaction and Persistence Patterns 050831-0 Ch03.F 1/25/02 9:23 AM Page 69 CHAPTER 3 Transaction and Persistence Patterns This chapter contains a set of diverse patterns that solves problems involving transaction control, persistence, and

More information

Persistenz: Wie speichere ich meine Geschäftsobjekte?

Persistenz: Wie speichere ich meine Geschäftsobjekte? Persistenz: Wie speichere ich meine Geschäftsobjekte? Vorlesung: Software-Engineering für große, betriebliche Informationssysteme für Universität Leipzig, Sommersemester 2004 Institut für Software- und

More information

Course Entity Bean CODE

Course Entity Bean CODE Q.1. Implement award list of MCA 1st year as a XML document. The table must have semester No, student s Enrollment No, TEE marks of all the theory subjects, practical subjects and assignments. Q. 2. Create

More information

Lecture 9&10 JDBC. Mechanism. Some Warnings. Notes. Style. Introductory Databases SSC Introduction to DataBases 1.

Lecture 9&10 JDBC. Mechanism. Some Warnings. Notes. Style. Introductory Databases SSC Introduction to DataBases 1. Lecture 9&10 JDBC Java and SQL Basics Data Manipulation How to do it patterns etc. Transactions Summary JDBC provides A mechanism for to database systems An API for: Managing this Sending s to the DB Receiving

More information

Java Database Connectivity

Java Database Connectivity Java Database Connectivity ADVANCED FEATURES Dr. Syed Imtiyaz Hassan Assistant Professor, Deptt. of CSE, Jamia Hamdard (Deemed to be University), New Delhi, India. s.imtiyaz@jamiahamdard.ac.in Agenda Scrollable

More information

Distributed Applications (RMI/JDBC) Copyright UTS Faculty of Information Technology 2002 EJB EJB-3

Distributed Applications (RMI/JDBC) Copyright UTS Faculty of Information Technology 2002 EJB EJB-3 Advanced Java programming (J2EE) Enterprise Java Beans (EJB) Part 1 Architecture & Session Beans Chris Wong chw@it.uts.edu.au [based on prior course notes & the Sun J2EE tutorial] Enterprise Java Beans

More information

Database Programming Overview. COSC 304 Introduction to Database Systems. Database Programming. JDBC Interfaces. JDBC Overview

Database Programming Overview. COSC 304 Introduction to Database Systems. Database Programming. JDBC Interfaces. JDBC Overview COSC 304 Introduction to Database Systems Database Programming Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Database Programming Overview Most user interaction with

More information

EJB 2 - Complex Container Managed Relations (CMP) with JBoss

EJB 2 - Complex Container Managed Relations (CMP) with JBoss EJB 2 - Complex Container Managed Relations (CMP) with JBoss In this tutorial we will show you multiple examples to create CMP relations between EJB. We will use xdoclet to create the interfaces you will

More information

Persistence for Large Enterprise Systems in the Java World

Persistence for Large Enterprise Systems in the Java World Persistence for Large Enterprise Systems in the Java World Bernhard Schiefer* and Christian Fecht** *FH Kaiserslautern Amerikastr. 1, 66482 Zweibrücken schiefer@informatik.fh-kl.de **SAP AG Neurottstr.

More information

Oracle 10g: Build J2EE Applications

Oracle 10g: Build J2EE Applications Oracle University Contact Us: (09) 5494 1551 Oracle 10g: Build J2EE Applications Duration: 5 Days What you will learn Leading companies are tackling the complexity of their application and IT environments

More information

Self-test Database application programming with JDBC

Self-test Database application programming with JDBC Self-test Database application programming with JDBC Document: e1216test.fm 16 January 2018 ABIS Training & Consulting Diestsevest 32 / 4b B-3000 Leuven Belgium TRAINING & CONSULTING INTRODUCTION TO THE

More information

Accessing databases in Java using JDBC

Accessing databases in Java using JDBC Accessing databases in Java using JDBC Introduction JDBC is an API for Java that allows working with relational databases. JDBC offers the possibility to use SQL statements for DDL and DML statements.

More information

Component Interfaces

Component Interfaces Component Interfaces Example component-interfaces can be browsed at https://github.com/apache/tomee/tree/master/examples/component-interfaces Help us document this example! Click the blue pencil icon in

More information

Working with Databases and Java

Working with Databases and Java Working with Databases and Java Pedro Contreras Department of Computer Science Royal Holloway, University of London January 30, 2008 Outline Introduction to relational databases Introduction to Structured

More information

jar command Java Archive inherits from tar : Tape Archive commands: jar cvf filename jar tvf filename jar xvf filename java jar filename.

jar command Java Archive inherits from tar : Tape Archive commands: jar cvf filename jar tvf filename jar xvf filename java jar filename. jar & jar files jar command Java Archive inherits from tar : Tape Archive commands: jar cvf filename jar tvf filename jar xvf filename java jar filename.jar jar file A JAR file can contain Java class files,

More information

EJB 2.1 CMP EntityBeans (CMP2)

EJB 2.1 CMP EntityBeans (CMP2) EJB 2.1 CMP EntityBeans (CMP2) Example simple-cmp2 can be browsed at https://github.com/apache/tomee/tree/master/examples/simple-cmp2 OpenEJB, the EJB Container for TomEE and Geronimo, does support all

More information

Multi-tier architecture performance analysis. Papers covered

Multi-tier architecture performance analysis. Papers covered Multi-tier architecture performance analysis Papers covered Emmanuel Cecchet, Julie Marguerie, Willy Zwaenepoel: Performance and Scalability of EJB Applications. OOPSLA 02 Yan Liu, Alan Fekete, Ian Gorton:

More information

MindTelligent, Inc. EJB 2.0 Design and Development with JDeveloper 9i and stand alone OC4J (Oracle Components for Java) A Technical White Paper.

MindTelligent, Inc. EJB 2.0 Design and Development with JDeveloper 9i and stand alone OC4J (Oracle Components for Java) A Technical White Paper. MindTelligent, Inc. EJB 2.0 Design and Development with JDeveloper 9i and stand alone OC4J (Oracle Components for Java) A Technical White Paper. Published by MindTelligent 2034, Lamego Way, El Dorado Hills,

More information