The TopLink runtime provides Java or Java EE applications with access to persistent entities stored in a data source. In addition to run-time capabilities, the TopLink Foundation Library includes the TopLink Application Programming Interface (API). This API enables applications to access TopLink run-time features.
TopLink includes additional development tools that simplify application development. These tools capture mapping and run-time configuration information in metadata files that TopLink passes to the application at run time.
This chapter includes the following sections:
TopLink metadata is the link between the two (see Section 2.9, "Working with TopLink Metadata").
Figure 3-1 illustrates how these elements interact with the data source.
To create a TopLink application, use Oracle JDeveloper TopLink Editor or TopLink Workbench to map objects to data sources using relational and nonrelational models. Capture the resulting mappings and additional run-time configurations in the TopLink project file (
project.xml) and build a session configuration file (
sessions.xml). These files together represent your entire TopLink project, as shown in Figure 3-2.
During development, you can use the TopLink API to define query and transaction logic. When you use entity beans, there is generally little or no direct use of the TopLink API and there is no session or
TopLink Workbench can import compiled entity classes (Java objects or EJB entity beans), as well as relational or nonrelational schemas through a JDBC driver (configured by you). Because TopLink imports the object and relational models for mapping, you can develop the two models relatively independently from the mapping phase of a project development.
The TopLink Foundation Library provides the TopLink run-time component. Access the run-time component either directly through the TopLink API or indirectly through a Java EE container when using entity beans with container-managed persistence. The run-time environment is not a separate or external process–it is embedded within the application. Application calls invoke TopLink to provide persistence behavior. This function allows for transactional and thread-safe access to shared database connections and cached objects.
In addition to Java EE environments, TopLink fully supports non-Java EE environments as well. See Section 2.3, "Selecting an Architecture with TopLink" for more information.