Oracle TopLink Developer's Guide 10g Release 3 (10.1.3) B13593-01 |
|
![]() 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.
Figure 1-3 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 common enterprise architectures used by TopLink applications:
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.
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.
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 the developer with an EJB 1.n and 2.n (and, when used with OC4J, preliminary EJB 3.0) 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 CMP entity beans directly from the client, or from within a session bean layer. TopLink also offers the ability to use regular Java objects in relationships with EJB entity beans.
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.
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
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.