Skip Headers
Oracle® TopLink Getting Started Guide
10g (10.1.3.1.0)

Part Number B28217-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

3 Migrating to TopLink 10g (10.1.3.1.0)

This chapter describes how to migrate existing Oracle TopLink projects to TopLink 10g (10.1.3.1.0).

This chapter includes the following sections:

Refer to "Integrating TopLink With an Application Server" in the Oracle TopLink Developer's Guide for information on migrating existing OC4J or WebLogic persistence to TopLink.

Note:

If you receive ClassNotFound exceptions after you migrate a project, ensure the  JDBC_CLASSPATH variable does not include any Java classes for your persistent business objects. Paths for persistent business objects are set within an TopLink Workbench project. For more information, see "Configuring Project Classpath" in the Oracle TopLink Developer's Guide.

Also check your project classes for any references to legacy TopLink classes.

Migrating From 10.1.3.0 TopLink JPA Preview Persistence

In 10.1.3.0, TopLink provides a JPA preview based on a subset of the functionality specified in the EJB 3.0 public review draft.

In 10.1.3.1, TopLink provides full JPA support (through TopLink Essentials) as per the final EJB 3.0 specification.

See "EJB 3.0 JPA Persistence JAR Files" in the Oracle Containers for J2EE Enterprise JavaBeans Developer's Guide for information on specifying which JPA persistence implementation to use.

You must make code changes to your JPA preview-based application before using it with TopLink 10.1.3.1. This section describes the important differences between the TopLink JPA preview and full TopLink JPA to help you identify where changes must be made, including:

Changes in javax.persistence

Table 3-1 lists the additions, deletions, and changes made to the javax.persistence package between 10.1.3.0 and 10.1.3.1. If your application uses any of these classes, consult the latest EBJ 3.0 specification and JPA Javadoc for details.

Table 3-1 Changes to javax.persistence

10.1.3.0 10.1.3.1 Description

AccessMode

deleted

In 10.1.3.1, EJB 3.0 entities do not require local or remote interfaces. Because all entity access is by way of an EntityManager, clients need not be concerned about whether access is local or remote.

AccessType

deleted

In 10.1.3.1, the EJB 3.0 persistence specification requires the use of a single access type in an entity hierarchy. The placement of the mapping annotations determines the access type in effect.

not applicable

AssociationOverride

Added in 10.1.3.1 as part of the changes made to annotations for inheritance.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#AssociationOverride.

not applicable

AssociationOverrides

Added in 10.1.3.1 as part of the changes made to annotations for inheritance.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#AssociationOverrides.

Basic

Basic

In 10.1.3.1, attribute temporalType is omitted.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#Basic.

not applicable

DiscriminatorValue

Added in 10.1.3.1 as part of the changes made to annotations for inheritance.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#InheritanceAnnotations

EmbeddableSuperclass

deleted

Added in 10.1.3.1 as part of the changes made to annotations for inheritance.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#InheritanceAnnotations

Entity

Entity

In 10.1.3.1, attribute access is omitted.

not applicable

EntityExistsException

Added in 10.1.3.1.

EntityListener

deleted

In 10.1.3.1, use EntityListners instead.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#EntityListeners.

not applicable

EntityListeners

Added in 10.1.3.1.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#EntityListeners.

EntityManager

EntityManager

In 10.1.3.1, EntityManager method getUserTransaction is named getTransaction.

New methods added in 10.1.3.1 include:

  • setFlushMode

  • getFlushMode

  • lock

  • clear

  • joinTransaction

  • getDelegate

In 10.1.3.1, methods of this class throw additional exceptions such as EntityExistsException and IllegalStateException and in some cases, methods throw IllegalStateException instead of IllegalArgumentException.

EntityNotFoundException

EntityNotFoundException

In 10.1.3.1, this exception extends PersistenceException instead of RuntimeException.

EntityTransaction

EntityTransaction

New methods added in 10.1.3.1, include:

  • setRollbackOnly

  • getRollbackOnly

EntityType

deleted

In 10.1.3.1, the EJB 3.0 specification removes the concept of BMP.

To develop and deploy a Java EE 5 BMP application, you must use the EJB 2.1 API.

not applicable

Enumerated

Added in 10.1.3.1 to support direct mappings of enumerated types.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#Enumerated.

not applicable

EnumType

Added in 10.1.3.1 to support direct mappings of enumerated types.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#Enumerated.

not applicable

ExcludeDefaultListeners

Added in 10.1.3.1 to support managing lifecycle callback default listeners.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#ExcludeDefaultListeners.

not applicable

ExcludeSuperclassListeners

Added in 10.1.3.1 to support managing lifecycle callback superclass listeners.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#ExcludeSuperclassListeners.

FlushMode

deleted

In 10.1.3.1, to set the flush mode, use the EntityManager method setFlushMode to set the FlushModeType.

not applicable

GeneratedValue

Added in 10.1.3.1 to support automatic primary key (identity) generation.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#GeneratedValue.

not applicable

GenerationType

Added in 10.1.3.1 to support automatic primary key (identity) generation.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#GeneratedValue.

GeneratorType

deleted

In 10.1.3.1, use GeneratedValue attribute strategy to set the GenerationType.

Inhertiance

Inheritance

In 10.1.3.1, the following attributes are omitted:

  • discriminatorType

  • discriminatorValue

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#InheritanceAnnotations.

JoinColumn

JoinColumn

In 10.1.3.1, attribute secondaryTable is changed to table.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#JoinColumn.

JoinTable

JoinTable

In 10.1.3.1, attribute table (type Table) is changed to name (type String).

The following attributes are added:

  • catalog

  • schema

  • uniqueConstraints

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#JoinTable.

LobType

deleted

In 10.1.3.1, use direct mapping annotation Lob to specify a Lob type. A Lob may be either a binary or character type. The persistence provider infers the Lob type from the type of the persistent field or property.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#Lob.

not applicable

LockModeType


not applicable

MappedSuperclass

Added in 10.1.3.1 as part of the changes made to annotations for inheritance.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#MappedSuperclass.

NamedNativeQuery

NamedNativeQuery

In 10.1.3.1, attribute queryString changed to query and attribute hints was added.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#NamedNativeQuery.

NamedQuery

NamedQuery

In 10.1.3.1, attribute queryString changed to query and attribute hints was added.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#NamedQuery.

NoResultException

NoResultException

In 10.1.3.1, this exception extends PersistenceException instead of RuntimeException.

not applicable

OptimisticLockException


PersistenceContext

PersistenceContext

In 10.1.3.1, attribute properties was added.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#PersistenceContext.

not applicable

PersistenceProperty

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#PersistenceProperty.

not applicable

QueryHint

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#QueryHint.

not applicable

RollbackException


SecondaryTable

SecondaryTable

In 10.1.3.1, attribute pkJoin was changed to pkJoinColumns.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SecondaryTable.

SequenceGenerator

SequenceGenerator

In 10.1.3.1, the default for attribute initialValue changed from 0 to 1.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SequenceGenerator.

not applicable

SqlResultSetMappings

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#SqlResultSetMappings.

Table

Table

In 10.1.3.1, attribute specified is omitted.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#Table.

TableGenerator

TableGenerator

in 10.1.3.1, the following attributes were added:

  • catalog

  • schema

  • uniqueConstraints

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#TableGenerator.

not applicable

Temporal

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#Temporal.

TemporalType

TemporalType

In 10.1.3.1, enum value NONE is omitted.

For more information, see http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#Temporal.

TransactionRequiredException

TransactionRequiredException

In 10.1.3.1, this exception extends PersistenceException instead of RuntimeException.


Changes in oracle.toplink.essentials.platform.database

In 10.1.3.1, the following new classes were added:

  • DerbyPlatform

  • JavaDBPlatform

  • PostgreSQLPlatform

Acquiring an Entity Manager: Persistence Units and the persistence.xml File

In 10.1.3.0, you use the java.persistence.setup.config property to identify a class with the list of entities that an entity manager manages.

In 10.1.3.1, this property is obsolete. Instead, you must define managed entity classes in a persistence unit as per the EJB 3.0 specification. For more information, see:

New JAR Files

In 10.1.3.0, the persistence-preview.jar provides the TopLink JPA preview implementation.

In 10.1.3.1, the toplink-essentials.jar and toplink-essentials-agent.jar provides the full TopLink JPA implementation.

In your IDE, ensure that any library definitions you may have associated with your projects include only the 10.1.3.1 TopLink JPA libraries and exclude the old 10.1.3.0 libraries.

For more information about TopLink JAR files, see "TopLink JAR Files".

Upgrading TopLink Workbench Projects

Use Table 3-2 to upgrade both your TopLink Workbench project ( .mwp) and, if necessary, your project.xml file from a previous version of TopLink.

Table 3-2 Upgrading TopLink Workbench Projects

To Upgrade From... Use This Procedure...

Release 3 (10.1.3) and Release 2 (10.1.2)

  1. Open the existing project with the 10g (10.1.3.1.0) TopLink Workbench.

  2. Save the new TopLink Workbench project to a new location.

Release 2 (9.0.4)

  1. Open the existing project with the 10g (10.1.3.1.0) TopLink Workbench.

  2. Save the new TopLink Workbench project to a new location.

Release 1 (9.0.3)

  1. Open the existing project with the 10g (10.1.3.1.0) TopLink Workbench.

  2. Delete the passwords from all configured logins.

  3. Re-enter the passwords as plain (not encrypted) text for all configured logins.

  4. Export the project.xml.

    When you export the project.xml, the TopLink Workbench writes the login passwords using Java Cryptograph Extension (JCE) encryption (when using JDK 1.4 or higher).

    Use this new project.xml file at runtime.

  5. Save the new TopLink Workbench project to a new location.


Package Rename

Beginning with Release 1 (9.0.3), the base package for the entire TopLink product changed to oracle.toplink. To upgrade existing application source code which refers to TopLink API packages and existing TopLink Workbench projects previous to Release 1 (9.0.3), you must use the Package Rename tool.

You cannot use the TopLink Workbench's Rename Package function when migrating projects from earlier versions – you must use the Package Rename tool.

Note:

If you are upgrading from a version prior to Release 1 (9.0.3), you must convert the package names before you open your TopLink project(s) in 10g (10.1.3.1.0).

Use the Package Rename tool on your:

The Package Rename tool works on plain text files and must not be used with binary files (such as .jar).

Running the Package Rename Tool

Use this procedure to upgrade your existing pre-Release 1 (9.0.3) application source code and TopLink Workbench projects to version 10g (10.1.3.1.0).

  1. At the command prompt, execute the packageRename.cmd/sh program located in the <ORACLE_HOME>toplink/bin directory. You need to specify three parameters on the command line:

    • the complete directory path that contains the Java source code of your existing project

    • the complete directory path that will contain the upgraded 10g (10.1.3.1.0) project

    • the name of a log file. If no file is specified, the logging messages will print to standard output.

  2. Press Enter and the Package Rename tool will upgrade your project. The Package Rename tool requires approximately 15 minutes for a 1MB file. Larger files may require additional time.

  3. Repeat this procedure for your:

    • Source code

    • Configuration files

    • TopLink Workbench project files (*.mwp*.xml)

Updating Sessions XML Files

TopLink Workbench 10g (10.1.3.1.0) automatically updates your sessions.xml file, as needed. Simply open the file in 10g (10.1.3.1.0), update your data source information (if needed), and save the file.

In 10g (10.1.3.1.0), the sessions.xml file includes a <login> element that will override any login information included in your project.xml. Use one of the following approaches to correctly configure the session login:

See "TopLink Sessions" in the Oracle TopLink Developer's Guide for complete details.

Using Hosted XSD

For 10g (10.1.3.1.0), the XSD files for use with Oracle TopLink are included with the standard TopLink installation or available on OTN at:

http://www.oracle.com/technology/oracleas/schema/

Specifically, you can use the following XSD files: