Skip Headers

# TopLink Application Architectures

Previous

Next

You can use TopLink in a variety of application architectures, including three- and two-tier architectures, with or without J2EE, to access a variety of data types on both relational and nonrelational data sources.

TopLink and Your Application Architecture

Description of "TopLink and Your Application Architecture"

For more information on strategies for incorporating TopLink into your application architecture, see "Designing Your Application With TopLink".

This section introduces some of the following common enterprise architectures used by TopLink applications:

- Three-Tier

  The three-tier (or J2EE Web) application is one of the most common TopLink architectures. This architecture is characterized by a server-hosted environment in which the business logic, persistent entities, and the Oracle TopLink Foundation Library all exist in a single Java Virtual Machine (JVM). See "Understanding the Three-Tier Architecture" for more information.

  The most common example of this architecture is a simple three-tier application in which the client browser accesses the application through servlets, JavaServer Pages (JSP) and HTML. The presentation layer communicates with TopLink through other Java classes in the same JVM, to provide the necessary persistence logic. This architecture supports multiple servers in a clustered environment, but there is no separation across JVMs from the presentation layer and the code that invokes the persistence logic against the persistent entities using TopLink.

- EJB Session Bean Facade

  A popular variation on the three-tier application involves wrapping the business logic, including the TopLink access, in EJB session beans. This architecture provides a scalable deployment and includes integration with transaction services from the host application server. See "Understanding the EJB Session Bean Facade Architecture" for more information.

  Communication from the presentation layer occurs through calls to the EJB session beans. This architecture separates the application into different tiers for the deployment. The session bean architecture can persist either Java objects or EJB entity beans.

- EJB 3.0 Entities with JPA

  The EJB 3.0 specification includes an additional persistence specification called the Java Persistence API (JPA). You can use this API for creating, removing and querying across lightweight Java objects both within a compliant EJB 3.0 container and a standard Java SE 5 environment. TopLink Essentials is the open-source community edition of TopLink. It provides the JPA functionality for the EJB 3.0 reference implementation.

  Note: TopLink Essentials is the default JPA implementation in OC4J.

  When using TopLink JPA, you can access the API through extensions. The extensions allow you to reach down to the TopLink API and modify the JPA implementation.

  To obtain more information, see the following:

  - `http://www.oracle.com/technology/products/ias/toplink/jpa/index.html`.

  - "Understanding the EJB 3.0 JPA Entity Architecture".

- EJB Entity Beans with CMP

  TopLink provides CMP support for applications that require the use of EJB entity beans. This support is available on the leading application servers. TopLink CMP support provides you with an EJB 1.0, 1.1, 2.0 and 2.1 CMP solution transparent to the application code, but still offers all the TopLink run-time benefits. See "Understanding the EJB Entity Beans With CMP Architecture" for more information.

  Applications can access TopLink-enabled entity beans with container-managed persistence directly from the client, or from within a session bean layer. TopLink also offers the ability to use regular Java objects in relationships with enterprise entity beans.

  Note: Even though TopLink fully supports EJB 1.0, 1.1, 2.0, 2.1 and, preliminarily EJB 3.0, this version of Oracle TopLink Developer's Guide only focuses on EJB 2.0 and 2.1. For detailed information on TopLink support for EJB 1.0 and 1.1, refer to the earlier versions of Oracle TopLink Developer's Guide.

- EJB Entity Beans with BMP

  Another option for using EJB entity beans is to use TopLink BMP in the application. This architecture enables developers to access the persistent data through the EJB application programming interface (API), but is platform independent. See "Understanding the EJB Entity Beans With BMP Architecture" for complete information.

  The BMP approach is portable–that is, after you create an application, you can move it from one application server platform to another.

- Web Services

  A Web services architecture is similar to the three-tier or session-bean architecture. However, in a Web services architecture you encapsulate business logic (the service) in a Web service instead of (or in addition to) using session beans. In a Web services architecture, clients communicate with your application using XML.

  As in any architecture, you can use TopLink to persist objects to relational or EIS data sources. However, in a Web services architecture you can also use TopLink to map your object model to an XML schema for use with the Web service or as the Web service XML serializer.

  See "Understanding the Web Services Architecture" for more information

- Two-Tier

  A two-tier (or client/server) application is one in which the TopLink application accesses the database directly. Although less common than the other architectures discussed here, TopLink supports this architecture for smaller or embedded data processing applications. See "Understanding the Two-Tier Architecture" for more information.