Skip Headers
Oracle® Application Server TopLink Application Developer's Guide
10g Release 2 (10.1.2)
Part No. B15901-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Application Development With OracleAS TopLink

Using OracleAS TopLink to build an application does not affect the choice of development tools or the creative process. However, OracleAS TopLink does influence how you approach development. This section highlights some of the key areas in which using OracleAS TopLink affects application development. These areas exist, regardless of whether you are building an application to support Java objects, EJB entity beans, or both.

Mapping

OracleAS TopLink maps the persistent entities of the application to the database, using the descriptors and mappings you build with OracleAS TopLink Mapping Workbench. OracleAS TopLink Mapping Workbench supports several approaches to project development, including:

  • Importing classes and tables for mapping

  • Importing classes and generating tables and mappings

  • Importing tables and generating classes and mappings

  • Creating both class and table definitions with mapping creation and model generation

OracleAS TopLink Mapping Workbench supports all these options; however, the most common solution is to develop the persistent entities using a development tool, such as an integrated development environment (IDE) or modeling tool, and to develop the relational model through appropriate relational design tools. You then use OracleAS TopLink Mapping Workbench to construct mappings that relate these two models.

OracleAS TopLink Mapping Workbench does offer some facilities for generating persistent entities or the relational model components for an application; however, these utilities are intended only to assist in rapid initial development strategies, rather than complete round-trip application development.

For more information about mapping, see Chapter 3, "Mapping", and also see the Oracle Application Server TopLink Mapping Workbench User's Guide.

Session Management

Sessions are the primary interface between the application and OracleAS TopLink persistence capabilities. When developing an OracleAS TopLink application, you must properly initialize and manage the sessions.

When using EJB entity beans with container-managed persistence (CMP) or bean-managed persistence (BMP), the client code that modifies the entity beans does not access the OracleAS TopLink session directly. Instead, changes occur transparently, through integration with the container or through EJB callbacks.

Well-designed applications that employ Java objects as persistent entities use the session manager provided in the OracleAS TopLink API. This class initializes and manages the singleton session. You configure the session manager in the sessions.xml file, which allows for easy configuration and customization of the deployed application.

For more information about session management, see Chapter 4, "Sessions".

Querying

OracleAS TopLink provides several object and data query types, and offers flexible options for query selection criteria, including:

  • OracleAS TopLink expressions

  • EJB QL

  • SQL

  • Stored procedures

  • Query by example

With these options, you can build any type of query. We recommend that you use predefined queries to define application queries. Predefined queries are held in the project metadata and referenced by name. This feature simplifies application development and encapsulates the queries to reduce maintenance costs.

OracleAS TopLink Mapping Workbench provides the simplest way to define queries. You can also build queries in code, using the OracleAS TopLink API.

If the application includes EJB entity beans, you can code finders completely using EJB QL, which enables the application to comply with the J2EE specification. Alternatively, you can use any of the other OracleAS TopLink query options. All querying options are available, regardless of the architecture or persistent entity type.

For more information about querying, see Chapter 6, "Queries".

Transactions

In an OracleAS TopLink application, the Unit of Work ensures that OracleAS TopLink transactions comply with the transactional requirements of the application.

The Unit of Work is one of the most sophisticated and powerful components of the OracleAS TopLink Foundation Library. Although you can use CMP or BMP entity beans that do not use the OracleAS TopLink API to apply transactional changes to their persistent entities, the Unit of Work is used behind the scenes. Understanding how the Unit of Work behaves, and developing simple coding patterns to use it, are the keys to building efficient, maintainable applications.

For more information about transaction, see Chapter 7, "Transactions".

Packaging and Deployment

Application packaging (for deployment in the host Java or J2EE environment) influences OracleAS TopLink use and configuration. For example, developers package a J2EE enterprise application in an Enterprise Archive (EAR) file. Within the EAR file, there are several ways to package persistent entities within Web Application (WAR) and Java libraries (JAR). How you configure OracleAS TopLink depends, in part, on how you package the application and how you use the host application server class loader.

For more information about packaging and deployment, see Chapter 9, "Packaging for Deployment".

Monitoring and Performance Tuning

OracleAS TopLink enables you to monitor functionality and performance throughout application development, testing, and quality assurance cycles. OracleAS TopLink offers logging methods, as well as the API required to implement custom logging strategies. You can use these features to ensure that the application behaves and performs as you expect.

OracleAS TopLink includes a performance profiler feature, available through the OracleAS TopLink Foundation Library API. This runtime feature tracks query execution time, which you can use for performance analysis. This tool provides the information necessary to identify bottlenecks that hinder application performance.

OracleAS TopLink also offers a rich set of performance enhancement features. Understanding how to configure these features can have a strong influence on application performance, especially in the later phases of application development.

For more information about monitoring and performance tuning, see Chapter 10, "Tuning for Performance".