OCI JULY ISSUE
4500 S. Lakeshore Drive, Suite 359, Tempe, AZ 85282 Office: 480-752-0042 1-888-962-4624
Java Technical Insight of the Month - Enterprise Java Beans "What is EJB?"
Why Java? here are a few reasons...
OCI Education Center - Open Enrollment
Java Technical Insight of the Month - Enterprise Java Beans
What is EJB?
By Brad Warren, Software Engineer, Object Computing, Inc.
Enterprise Java Beans (EJB) is a specification provided by Sun Microsystems that defines a framework and development model for server side components in Java. Much like the Java platform itself, EJB is simply a specification, the implementation is provided by vendors who develop their products to conform to the specification. EJB is built on top of existing distributed computing technologies such as CORBA and RMI. EJB is designed to simplify software development by eliminating a lot of the infrastructure development associated with storing, retrieving, and accessing server side components. It is also designed to provide one common interface to all infrastructure services, such as naming and transaction processing. To date, many application server vendors have provided EJB implementations as part of their products. By being Java implementations, EJB components can be run on any software platform and, in addition, can be run on any EJB compliant application server.
EJB components are called beans. These beans are self-contained, reusable objects that execute within the context of a container. The container is responsible for providing management and control for the beans running inside of it. It manages client connections, bean lifecycle, state management, storage and persistence, security, and transactions. These can also be customized by the developer. The EJB server provides an implementation of the container and at runtime may support multiple containers. EJB servers can be transaction processing (TP) monitors, application servers, or database servers.
Types of Beans
Enterprise Java beans can take the form of a session bean or entity bean. A session bean is created by a client and usually executes operations on the client's behalf. A stateless session bean may only exists for the duration of a single method call, however most implementations will maintain the stateless session bean for the duration of an entire client session. A stateful session bean will exist for multiple method calls, maintaining the bean's state in between calls. A stateful session bean is responsible for maintaining its own persistent data. An entity bean is a representation of a persistent data object. Normally, this means that the entity bean corresponds to some data stored in a database.
An entity bean may have its persistence managed by the container or by itself. If the bean's persistence is managed by the container, the container provides the mapping between the bean's data and the data store. When the bean manages its own persistence, it must provide the mechanism for storing and retrieving its data from the data store (usually JDBC). For identification, the entity bean has a primary key defined. This primary key may be used to store and retrieve the bean data, as well as uniquely identify the entity bean within the container.
Transactions for the beans is based on the Java Transaction Service (JTS). The JTS provides an interface to the Object Transaction Service (OTS) for CORBA, which supports transactions across multiple objects and multiple databases. Applications communicate with JTS through the Java Transaction API (JTA), which provides access to transactions. Transactions for the beans may be managed by the container, the client, or the beans themselves. If the client or the beans manage transactions, they must explicitly start, join, commit, and rollback transactions manually through the JTA. Otherwise, no transaction demarcation code is necessary.
The following sources have more information about EJB:
Why Java? here are a few reasons...
Portability - application logic, user interfaces, database access; ...not perfect portability but much better than other languages.
Support for Web-based Applications - applets for client-side processing; servlets for server-side processing
Built-in support for multi-threading
Built-in support for socket communication
Support of network protocols
Provides multiple ways of creating distributed applications - sockets, RMI, CORBA, Enterprise Java Beans, Mobile Agents, Servlets and JavaSpaces
Object-Oriented - reuse; maintainability, extensibility
Automatic garbage-collection (memory management)
Productivity - easier syntax than C++, no need to relink after each code change (speeds debugging)
OCI Education Center - Open
Registration is being accepted for the Summer-Fall 1999 schedule. Courses are held weekdays from 8:30 a.m. - 3:30 p.m. at the Mesa Community College Business & Industry Institute. To register call 480-752-0042 or email training for more information. Click on hypertext for course descriptions and schedule.
Java Syntax for Non-C Programmers
Developing GUIs using Java
Java Beans Programming
Advanced Java Programming
Java Servlet Programming
Introduction to XML
Enterprise Java Beans
Analysis and Design
Object Oriented Analysis and Design
Introduction to C++ for Non-C Programmers
Object-Oriented Programming and C++
Object Computing, Inc. is a Sun
Authorized Java Center in St. Louis and a Member of the Object Management Group,
OMG. OCI specializes in distributed computing using object-oriented and web-enabled
technologies and provides Consulting, Education,
Development services to clients nation-wide. For more information contact our
Tempe office at 480-752-0042 or email info.
The Java News Brief is a monthly newsletter. The purpose and intent of this publication is to advance Java, provide technical value, and to announce available OCI Java services. If you would prefer to not receive this newsletter or would like to subscribe please email JNB and enter SUBSCRIBE or UNSUBSCRIBE within the Subject line.
Copyright (c) 1999. Object Computing, Inc. All rights reserved.
Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Object Computing, Inc. is independent of Sun Microsystems, Inc.
OMG, OBJECT MANAGEMENT GROUP, the OBJECT MANAGEMENT GROUP logo, CORBA, CORBA ACADEMY, THE INFORMATION BROKERAGE, DISTRIBUTED OBJECT COMPUTING, OBJECT REQUEST BROKER, ORB, OMG IDL, IIOP, The CORBA LOGO, CORBA THE GEEK & the CORBA THE GEEK design, UNIFIED MODELING LANGUAGE, and UML are trademarks of Object Management Group, Inc. in the United States.