Oracle® Fusion Middleware Solution Guide for Oracle Toplink 11G Release 1 (11.1.1) E25034-02
Total Page:16
File Type:pdf, Size:1020Kb
Oracle® Fusion Middleware Solution Guide for Oracle TopLink 11g Release 1 (11.1.1) E25034-02 March 2012 This document describes a number of scenarios, or use cases, that illustrate TopLink features and typical TopLink development processes. Oracle Fusion Middleware Solution Guide for Oracle TopLink, 11g Release 1 (11.1.1) E25034-02 Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle America, Inc., 500 Oracle Parkway, Redwood City, CA 94065. This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. This software or hardware and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services. Contents Preface ................................................................................................................................................................. xi Audience....................................................................................................................................................... xi Documentation Accessibility.................................................................................................................... xii Related Documents .................................................................................................................................... xii Conventions ................................................................................................................................................ xii 1 Introduction 1.1 About This Book.......................................................................................................................... 1-1 1.2 What You Need to Know First.................................................................................................. 1-1 1.3 The Use Cases.............................................................................................................................. 1-2 2 Using TopLink with WebLogic Server 2.1 Understanding TopLink and WebLogic Server ..................................................................... 2-1 2.1.1 Advantages to Using TopLink with WebLogic Server .................................................. 2-1 2.1.2 The Relationship of TopLink to Other Fusion Middleware Products ......................... 2-2 2.2 What You Need to Start ............................................................................................................. 2-3 2.3 Main Tasks ................................................................................................................................... 2-4 2.3.1 Task 1: Set TopLink as the Default JPA Provider (WebLogic Server 11g)................... 2-4 2.3.2 Task 2: Apply the Patch to Support JPA 2.0 in WebLogic Server 11g.......................... 2-5 2.3.3 Task 3: Update the Version of EclipseLink in WebLogic Server ................................. 2-5 2.3.4 Task 4: Configure JMX MBean Extensions in WebLogic Server................................... 2-7 2.3.5 Task 5: Use or Reconfigure the Logging Integration...................................................... 2-8 2.3.5.1 How the Logging Integration Works......................................................................... 2-8 2.3.5.2 Viewing Persistence Unit Logging Levels in the Administration Console.......... 2-9 2.3.5.3 Overriding the Default Logging Integration............................................................ 2-9 2.3.5.4 Configuring WebLogic Server to Expose TopLink Logging.................................. 2-9 2.3.5.5 Other Considerations................................................................................................ 2-10 2.3.6 Task 6: Add Persistence to Your Java Application Using TopLink........................... 2-10 2.3.7 Task 7: Configure a Data Source..................................................................................... 2-11 2.3.7.1 Ways to Configure Data Sources for JPA Applications....................................... 2-11 2.3.7.2 Configure a Globally-Scoped JTA Data Source .................................................... 2-11 2.3.7.2.1 Create the Data Source in WebLogic Server................................................... 2-11 2.3.7.2.2 Configure persisence.xml.................................................................................. 2-12 2.3.7.3 Configure an Application-Scoped JTA Data Source ............................................ 2-12 2.3.7.3.1 Specify That the Data Source Is Application-Scoped.................................... 2-12 iii 2.3.7.3.2 Add the JDBC Module to the WebLogic Application Configuration ........ 2-13 2.3.7.3.3 Configure the JPA Persistence Unit to Use the JTA Data Source................ 2-13 2.3.7.4 Configure a non-JTA Data Source and Manage Transactions in the Application ...... 2-14 2.3.7.5 Make Sure the Settings Match ................................................................................. 2-14 2.3.8 Task 8: Extend the Domain to Use Advanced Oracle Database Features ................ 2-15 2.3.9 Task 10: Start WebLogic Server and Deploy the Application .................................... 2-16 2.3.10 Task 11: Run the Application.......................................................................................... 2-16 2.3.11 Task 12: Configure and Monitor Persistence Settings in WebLogic Server ............. 2-16 2.4 Additional Resources .............................................................................................................. 2-17 2.4.1 Code Samples .................................................................................................................... 2-17 2.4.2 Related Javadoc................................................................................................................. 2-17 3 Using TopLink with GlassFish Server 3.1 Understanding TopLink and GlassFish Server ...................................................................... 3-1 3.1.1 Advantages to Using TopLink with GlassFish Server ................................................... 3-1 3.1.2 Relationship of GlassFish Server and TopLink to Fusion Middleware Products ...... 3-2 3.2 What You Need to Start ............................................................................................................. 3-3 3.3 Main Tasks ................................................................................................................................... 3-4 3.3.1 Task 1: Add Object-XML (JAXB) Support to GlassFish Server (optional)................... 3-4 3.3.2 Task 2: Set Up the Datasource...........................................................................................