Oracle® Application Server TopLink Application Developer's Guide
10g Release 2 (10.1.2) Part No. B15901-01 |
|
Previous |
Next |
This section introduces concepts that help you evaluate the architectures presented in this chapter.
The architectures in this chapter fall into two categories, depending on whether you use Java objects or EJB entity beans to manage the persistent data.
OracleAS TopLink enables you to use simple Java objects as the persistent mapped entities in your application. To manage them, you use the OracleAS TopLink API or, optionally, the Java Data Objects (JDO) API.
Enterprise JavaBean (EJB) technology is a component-based architecture that enables you to develop distributed, object-oriented applications in Java. OracleAS TopLink offers support for EJB entity beans through both bean-managed persistence (BMP) and container-managed persistence (CMP).
Regardless of how you manage persistence, EJB applications require you to integrate the OracleAS TopLink framework with the hosting application server. This integration enables you to leverage the connection pooling and transaction management offered through the application server's Java Transaction Architecture (JTA) support.
EJBs, developed by Sun Microsystems and its partners, represent a standard in enterprise computing. EJB is not a product, but rather a specification. It provides a framework for developers who create distributed business applications, and vendors who design application servers.
EJB is an important specification because of the widespread support it enjoys from enterprise software vendors.
For more information about EJBs, see the following Web sites
http://java.sun.com/products/ejb/ http://java.sun.com/products/ejb/docs.html http://java.sun.com/j2ee/white/index.html
An enterprise application integrates multiple heterogeneous systems, such as database servers, legacy applications, and mainframe applications. An enterprise application may also be required to support a diverse range of clients, including:
Remote Method Invocation (RMI)
Hypertext Markup Language (HTML)
Extensible Markup Language (XML)
Common Object Request Broker Architecture (CORBA)
Distributed Component Object Model (DCOM)
The multi-tier approach enables you to build complex enterprise applications that integrate with other systems in the application server tier. Many different types of enterprise architectures use the multi-tier approach.
Java and J2EE applications usually include several tiers, or layers. These layers can include the client tier, the presentation tier, the application tier, and the persistence tier.
An application client tier provides users with access to application functions. Its primary tasks are to present information from the application and to accept user input. For example, Web applications commonly present a browser as the client tier, but may also provide a Java (Swing) interface, a wireless device, or another application.
The presentation tier provides information interchange for the application. This tier is often a Java Server Pages (JSP) or servlet front end, an RMI or CORBA interface, or a Web Service.
The application tier holds the application business logic. Users access this tier either directly from the presentation layer using Java calls or through remote interfaces, such as RMI, EJB, and CORBA.
The application interacts with OracleAS TopLink at the application tier to provide application behavior. The user can query for and manipulate persistent entities through this tier.
The persistence tier provides access to the underlying datasource, after a relational database. In an application enabled by OracleAS TopLink, OracleAS TopLink provides most of the functionality for this tier. The application developer adds queries, mappings, and persistent entities to complete and enable the tier.
The architectures presented in this chapter leverage the different OracleAS TopLink sessions and session components.
For more information about the session components, see Chapter 4, "Sessions".
The session manager is a singleton mechanism that manages the sessions within a given Java Virtual Machine (JVM). In most systems, the session manager retrieves the sessions from the sessions.xml
file. This file contains the information required to instantiate sessions and their related mappings.
The server session manages the persistence for a single OracleAS TopLink project, cached objects, query execution, and maintaining shared JDBC resources. The session manager manages the server session.
The server session requires a client session to enable client access.
The client session handles client interaction with the server. The server session manages the client session.
The project contains mapping information for the persistence system. OracleAS TopLink stores the project in either a deployment XML format or a generated class. OracleAS TopLink Mapping Workbench generates the project file in either of these formats.
The database session is a singleton session used in a two-tier application instead of the Client-Server model used in the three-tier architectures. The main difference is that the database session manages a single JDBC connection (used for both reading and writing). This approach also assumes that only a single client involved and the cache is, therefore, not shared.
The project contains default database login information, including a user name and password. You can also override this information by including alternative login information for a session, either in the sessions.xml
file or in custom code.
The Unit of Work, the native transaction mechanism of OracleAS TopLink, offers several advantages over a standard database transaction. It is the most efficient mechanism to apply changes to the object model in all OracleAS TopLink usage patterns.
For more information about the Unit of Work, see Chapter 7, "Transactions".