Fall CIS 764 Database Systems Engineering L7. EJB’s
Fall CIS 764 Database Systems Engineering
Fall CIS 764 Database Systems Engineering … V. Bush, concept of hypertext 1961 … Kleinrock paper on packet switching 1966 … Roberts, plan for ARPA net 1967 … hypertext system, Brown Univ 1969 …. ARPA net, 4 nodes 1972 … … Cerf, Kahn … TCP paper 1981 … APRA net down, status virus 1982 … CS net 1986 … NSF net 1987 … 10 K nodes 1987 … Apple Hypercard 1988 … CERT 1989 … 100K nodes 1991 … WWW … CGI scripts (each request is separate process, non-OO)
Fall CIS 764 Database Systems Engineering … WWW … CGI scripts 1992 … 1M nodes 1995 … Java 1998 … Google … servlets … JDeveloper 1999 … J2EE, servlets, EJB 1 (RMI remote objects) JSP 1 (embedded code) 2000 … 20 M web sites 2001 … JDev separate from Borland 2003 … SQL Slammer worm … EJB 2 (adds QL ) … JSP 2 (tags ) 2005 … YouTube … Java annotations 2006 … Google buys YouTube … EJB 3 ( annotated POJO’s)
Fall CIS 764 Database Systems Engineering EJB specification details how an application server provides:application server Persistence Transaction processing Concurrency control Events using Java Message ServiceEventsJava Message Service Java Naming and directory services (JNDI)directory servicesJNDI Security ( Java Cryptography Extension (JCE) and JAAS )SecurityJava Cryptography Extension (JCE)JAAS Deployment of software components in an application serverDeploymentsoftware components Remote procedure calls using RMI-IIOP.Remote procedure callsRMI-IIOP Exposing business methods as Web Services.Web Services defines the roles played by the EJB container vs the EJBs From
Fall CIS 764 Database Systems Engineering … old EJB 1, 2
Fall CIS 764 Database Systems Engineering
Fall CIS 764 Database Systems Engineering EJB3 POJO + Annotations => EJB EJB 3.0 Resources Introduction: or Java World: (has more code examples)
Fall CIS 764 Database Systems Engineering Entity bean … bound to entity data, with unique key value; can contain multiple subitems. where is the concept of a result set ? Session bean … “session beans generally represent actions …” << bad OO ! “process entity” vs “data entity” Stateless … do not have internal state ( ) … rather: do not keep track of the callers state ! Stateful …..maintains the conversation state across multiple method invocations (e.g. a shopping cart) Beans have an associated deployment descriptor Beans have own QL … “OO version of sql “
Fall CIS 764 Database Systems Engineering EJB annotations
Fall CIS 764 Database Systems Engineering
Fall CIS 764 Database Systems Engineering import public class CalculateEJBBean implements CalculateEJB { int value = 0; public String incrementValue() { value++; return "value incremented by 1"; } }
Fall CIS 764 Database Systems Engineering import javax.persistence.*; import java.util.ArrayList; = "EMPLOYEES") public class Employee implements java.io.Serializable { private int empId; private String eName; private primaryKey=true) /* getters and setters here … see next slide }
Fall CIS 764 Database Systems Engineering public int getEmpId( ) { return empId; } public void setEmpId(int empId) { this.empId = empId; } public String getEname( ) { return eName; } public void setEname(String eName) { this.eName = eName; } public double getSal( ) { return sal; } public void setSal(double sal) { this.sal = sal; } public String toString() { StringBuffer buf = new StringBuffer(); buf.append("Class:").append(this.getClass(). getName()).append(" :: ").append(" empId:").append(getEmpId()). append(" ename:").append(getEname()).append("sal:").append(getSal()); return buf.toString(); } ??? Why the toString method <<<<<<<<<<<<<<<< ??? Why ArrayList and Collection
Fall CIS 764 Database Systems Engineering import javax.naming.Context; import javax.naming.InitialContext; public class CalculateejbClient { public static void main(String [] args) { Context context = new InitialContext(); CalculateEJB myejb = (CalculateEJB)context.lookup("java:comp/env/ejb/CalculateEJB"); myejb.incrementValue(); } } ??? Where does this “client” run ??
Fall CIS 764 Database Systems Engineering An OQL Resources ool_precision.doc/pr35se/xF html ool_precision.doc/pr35se/xF html
Fall CIS 764 Database Systems Engineering Homework: Oracle “EJB3 Simple Tutorial” 30.htm 30.htm Do an “in essence” version for the PO DB. (e.g. … not the DB in the tutorial, do not need to implements all of the operations) Note: This is not a web app. The client has remote access to the bean. The client does just text output. Post snapshots in JDev, running the client, link to code
Fall CIS 764 Database Systems Engineering Note: Begin planning for future requirements: Group project: requirements, design, implementation, doc’s (weekly during 2ed half of semester) Contribute some tutorial content … ** “how to” ( more Oracle tutorials or dotNet, Ruby, Eclipse, etc.) ( expend previous tutorials or add new ones ) Submit some technical paper …. ** concepts … not “how to” ( pages, w references, related to 764 topics ) Class presentation or either tutorial or paper: ** both require prior approval of topics.
Fall CIS 764 Database Systems Engineering end.