Entity Java Beans - DocJava HomePage
Download
Report
Transcript Entity Java Beans - DocJava HomePage
Entity Java Beans
Jorg Janke
http://www.compiere.org
Open Source ERP & CRM
Objectives
Know J2EE & EJB Buzzwords
Understanding of J2EE Architecture
Understanding of EJB Architecture
Know next steps to explore J2EE & EJB
Java Application Tiers
Java Application Tiers (Detail)
J2SE
EJB Types
Session Beans
Entity Bean
Stateless
Stateful
Bean Managed Persistency
Container Managed Persistency (CMP)
Message Bean
Stateless Session Bean
Stateful Session Bean
Entity Bean
Message Bean
EJB Source Code
Home Interface (extends EJBHome)
Remote Interface (EJBObject)
Create - Find (for Entity)
Factory Pattern
“Business Methods”
Proxy Pattern
Bean Class (EntityBean/SessionBean)
Deployment descriptor (ejb-jar.xml)
EJB Runtime
Home (“create”, “find”)
EJB (“business methods”)
Home Object Stub
Home Object
EJB Object Stub
EJB Object
Bean (“the entity”)
Enterprise Bean Object
EJB Container - Client
JNDI
Home Stub
Client
Home Stub
Home
Object
RMI-IIOP
Object Stub
Object Stub
Container
EJB
Object
Enterprise
Bean
Object
EJB Use
Context ctx = new InitialContext();
BeanHome home = ctx.lookup(“myBean");
Container finds/creates Factory
BeanRemote bean = home.create();
JNDI to LDAP or other Directory Service
Container creates EJB Object -> myBean
Bean.doSomething();
Business Method “Proxy”
Getting started
The hard way
Download, Install & Implement the
J2EE Reference Implementation
(Cloudscape)
The easy way
Select a IDE
J2EE support often in “Enterprise Edition”
Free: Forte / NetBeans
Now you have your IDE …
Check what Containers are supported
(or included)
Download & Install the Container
E.g. JBoss includes Tomcat
IDEs provide
Wizards / Templates
Packaging & Deployment
For a live demo … visit me
JBuilder New …
New Module (multiple Beans)
New Session Bean
Stateless Session Bean
Session Bean Properties
Home Interface
Remote Interface
Bean Class
Deployment Descriptor
Add additional methods …
Create Test Client
Client 1 – Lookup
Client 1 - Create
Client 1 – Business Methods
Entity Bean
Home Interface
Remote Interface
Bean Class
Client 2
Client 2 – Lookup / Create
Client 2 – Business Methods
Java Application Tiers
How do EJBs “fit in”
Application Server
Business Objects
Coarse Grained Objects
Fine Grained Objects (not suited)
Local Interface
What is J2EE compliant
Server providing
Web Services
EJB with CMP
JMS, JTA, JAAS
Compliance Test
Application using
Servlet, JSP
JNDI, RMI, JDBC
EJB Services
Version 1.2, 1.3, …
License
One of the
technologies
Servlet or RMI &
JDBC will do
When to use EJBs
You need a EJB project for your CV
Highly shared, long lived objects
Container Managed Persistency (CMP)
Entity Beans
Data Access Object
Receiving Messages (JMS)
(Simple) Transaction Support (outside JDBC)
Security Support
Compiere & J2EE
Compiere does not use EJBs
EJB Container (candidate: JBoss)
Additional Installation effort
Additional Operation effort
Plus: Could be installed automatically
Compiere’s Business Objects (Invoice,..)
dynamically are generated
Based on Data Dictionary
Business Objects & Behavior are “personalized”
Intro Resources
http://java.sun.com/j2ee/
Deployathon
http://java.sun.com/blueprints
http://java.sun.com/j2ee/tutorial
J2EE “community” sites
http://www.theserverside.com
http://www.middleware-company.com/
http://www.onjava.com (O’Reilly)
Thanks
You can download the presentation
http://www.compiere.org/download
My contact:
http://www.compiere.com/consulting.html
[email protected]