fall 2008 1 cis 764 database systems engineering l7. ejb’s
TRANSCRIPT
Fall 2008 http://www.cis.ksu.edu 3
CIS 764 Database Systems Engineering
http://www.zakon.org/robert/internet/timeline/
1945 … 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 … email 1974 … 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 2008 http://www.cis.ksu.edu 4
CIS 764 Database Systems Engineering
http://www.zakon.org/robert/internet/timeline/
1991 … 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 2008 http://www.cis.ksu.edu 5
CIS 764 Database Systems Engineering
EJB specification details how an application server provides: Persistence Transaction processing Concurrency control Events using Java Message Service Java Naming and directory services (JNDI) Security ( Java Cryptography Extension (JCE) and JAAS ) Deployment of software components in an application server Remote procedure calls using RMI-IIOP. Exposing business methods as Web Services.
defines the roles played by the EJB container vs the EJBs From http://en.wikipedia.org/wiki/Enterprise_JavaBean
Fall 2008 http://www.cis.ksu.edu 8
CIS 764 Database Systems Engineering
EJB3 POJO + Annotations => EJB
EJB 3.0 Resources http://www.oracle.com/technology/tech/java/ejb30.html
Introduction: http://www.oracle.com/technology/tech/java/newto/introejb.htm
or Java World: (has more code examples) http://www.javaworld.com/javaworld/jw-08-2004/jw-0809-ejb.html
Fall 2008 http://www.cis.ksu.edu 9
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 2008 http://www.cis.ksu.edu 10
CIS 764 Database Systems Engineering
EJB annotations http://www.fnogol.de/archives/2005/05/13/ejb-30-annotations-cheat-sheet/
Fall 2008 http://www.cis.ksu.edu 12
CIS 764 Database Systems Engineering
import javax.ejb.Stateless.*; @Stateless(name="CalculateEJB")public class CalculateEJBBean implements CalculateEJB{ int value = 0;
public String incrementValue() { value++; return "value incremented by 1"; }}
Fall 2008 http://www.cis.ksu.edu 13
CIS 764 Database Systems Engineering
import javax.persistence.*;import java.util.ArrayList;import java.util.Collection;
@Entity@Table(name = "EMPLOYEES")public class Employee implements java.io.Serializable{ private int empId; private String eName; private double sal;
@Id@Column(name="EMPNO", primaryKey=true)
/* getters and setters here … see next slide
}
Fall 2008 http://www.cis.ksu.edu 14
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 2008 http://www.cis.ksu.edu 15
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 2008 http://www.cis.ksu.edu 16
CIS 764 Database Systems Engineering
An OQL Resources
http://www.oracle.com/technology/sample_code/tutorials/fbs/eql/toc.htm
http://publib.boulder.ibm.com/infocenter/tivihelp/v8r1/index.jsp?topic=/com.ibm.netcool_precision.doc/pr35se/xF1118340.html
Fall 2008 http://www.cis.ksu.edu 17
CIS 764 Database Systems Engineering
Homework:
Oracle “EJB3 Simple Tutorial” http://www.oracle.com/technology/obe/obe1013jdev/10131/10131_ejb_30/ejb_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 2008 http://www.cis.ksu.edu 18
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” ( 2 .. 4 pages, w references, related to 764 topics )
Class presentation or either tutorial or paper:
** both require prior approval of topics .