JPOX
JPOX
 JPOX Version 1.0
Configuration | Tutorials | Worked Examples | Developer
Examples
Examples - Normal Collection

This example describes how to persist 2 classes that have a collection relationship between them. What we mean by that is that we have 2 classes Pack and Card such that each Pack can contain many Cards. We will show the classes that represent our example, and how we develop the JDO Meta-Data to represent them in the datastore.

The process of using JDO is split into 3 areas for this example. This is the most common subdivision in our experience, for explaining the ideas involved.

  1. Classes - Design your Java classes to represent what you want to model in your system. JDO doesn't have much of an impact on this, but we'll analyse the very minor influence it does have.
  2. Object Identity - Decide how the identities of your objects of thesee classes will be defined. Do you want JDO to give them id's or will you do it yourself.
  3. Meta-Data - Define how your objects of these classes will be persisted.
    1. New Database Schema - you have a clean sheet of paper and can have them persisted with no constraints.
    2. Existing Database Schema - you have existing tables that you need the objects persisted to.
Example Code

The full code is available for download from SourceForge. If you have any queries about this example, please raise them on our Forum.