Oracle9ias Toplink 9.0.3 Toplinktutorials

Oracle9ias Toplink 9.0.3 Toplinktutorials

Oracle9iAS TopLink Tutorials Release 2 (9.0.3) August 2002 Part No. B10062-01 Oracle9iAS TopLink Tutorials, Release 2 (9.0.3) Part No. B10062-01 Copyright © 2002, Oracle Corporation. All rights reserved. The Programs (which include both the software and documentation) contain proprietary information of Oracle Corporation; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent and other intellectual and industrial property laws. Reverse engineering, disassembly or decompilation of the Programs, except to the extent required to obtain interoperability with other independently created software or as specified by law, is prohibited. The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. Oracle Corporation does not warrant that this document is error-free. Except as may be expressly permitted in your license agreement for these Programs, no part of these Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Oracle Corporation. If the Programs are delivered to the U.S. Government or anyone licensing or using the programs on behalf of the U.S. Government, the following notice is applicable: Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercial computer software" and use, duplication, and disclosure of the Programs, including documentation, shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement. Otherwise, Programs delivered subject to the Federal Acquisition Regulations are "restricted computer software" and use, duplication, and disclosure of the Programs shall be subject to the restrictions in FAR 52.227-19, Commercial Computer Software - Restricted Rights (June, 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065. The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of such applications if the Programs are used for such purposes, and Oracle Corporation disclaims liability for any damages caused by such use of the Programs. Oracle is a registered trademark, and OracleMetaLink, Oracle Store, Oracle9i, Oracle9iAS Discoverer, SQL*Plus, and PL/SQL are trademarks or registered trademarks of Oracle Corporation. Other names may be trademarks of their respective owners. Contents Send Us Your Comments .................................................................................................................. vii Preface............................................................................................................................................................ ix Intended Audience ................................................................................................................................ ix Documentation Accessibility ................................................................................................................ x Structure ................................................................................................................................................... x Related Documents................................................................................................................................ xi Conventions........................................................................................................................................... xii 1 Introductory Tutorial Overview .............................................................................................................................................. 1-1 Creating the Database Schema......................................................................................................... 1-2 Creating a New Project ...................................................................................................................... 1-3 Setting the Project’s Classpath.................................................................................................... 1-6 Enabling Your Java Classes............................................................................................................... 1-8 Generating the Class Definitions.............................................................................................. 1-10 Logging into the Database .............................................................................................................. 1-13 Creating Tables.................................................................................................................................. 1-14 Creating Tables Using the Mapping Workbench .................................................................. 1-14 Creating the Table Definitions........................................................................................... 1-14 Creating the Tables on the Database ................................................................................ 1-15 Importing Tables from the Database ....................................................................................... 1-16 Mapping Classes and Tables in the Descriptor .......................................................................... 1-18 Mappings.............................................................................................................................. 1-18 iii Descriptors............................................................................................................................ 1-18 Mapping Classes to Tables ........................................................................................................ 1-18 Preparing the Primary Keys...................................................................................................... 1-20 Setting the Sequence Table ........................................................................................................ 1-20 Implementing Direct-to-field Mappings ................................................................................. 1-22 Setting the Sequence Name ....................................................................................................... 1-23 Creating One-to-one Mappings Between Objects.................................................................. 1-25 Foreign Key References ...................................................................................................... 1-26 Creating One-to-many Mappings ............................................................................................ 1-28 Setting up Database Sessions......................................................................................................... 1-30 Logging into a Database ............................................................................................................ 1-31 Creating the Tables in Code ...................................................................................................... 1-31 Using Descriptors in an Application............................................................................................. 1-32 Transactions and Units of Work............................................................................................... 1-32 Reading and Writing Java Class Instances.............................................................................. 1-33 Using a Unit of Work to Write an Object ................................................................................ 1-34 Using a Session to Read an Object............................................................................................ 1-35 Conclusion.......................................................................................................................................... 1-37 2 Advanced Tutorial Creating the Database Schema......................................................................................................... 2-2 Creating a New Project ...................................................................................................................... 2-7 Mapping Classes to Tables .......................................................................................................... 2-8 Using the Automap Tool.................................................................................................................... 2-8 Implementing Indirection................................................................................................................. 2-9 Preparing Java Code for Indirection .......................................................................................... 2-9 Implementing Indirection in the Mapping Workbench........................................................ 2-11 Implementing Indirection in the Tutorial ............................................................................... 2-11 Implementing a One-to-one self Relationship ........................................................................... 2-12 Creating Other One-to-one Mappings..................................................................................... 2-14 Implementing a One-to-many Self-relationship ........................................................................ 2-15 Creating Other One-to-many Mappings

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    86 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us