The files for this sample are located in the
        samples/persistence/models/humres
        directory of the Kodo installation. This sample demonstrates the mapping
        of an example "Human Resources" schema. The following concepts are
        illustrated in this sample:
    
Value Mappings
One to One Mappings
One to Many Mappings (with and without inverses)
This sample shows how to use the Kodo's JMX Management features. In order to see an example of runtime management:
Ensure that the Kodo distribution root directory is in your
                CLASSPATH
            
Ensure that an appropriate
                META-INF/persistence.xml
                is in
                a directory in your
                CLASSPATH
                or in the root level of a jar in your
                CLASSPATH
            
Ensure that your
                CLASSPATH
                has all of the jars distributed with Kodo
            
                javac *.java
            
                kodoc -p persistence.xml Animal.java Dog.java
                    Collar.java
            
                mappingtool -p persistence.xml Animal.java Dog.java
                    Collar.java
            
Enumerate the persistent classes in your
                persistence.xml
                file:
                <class>samples.persistence.management.Animal</class>
                    <class>samples.persistence.management.Dog</class>
                    <class>samples.persistence.management.Collar</class>
            
                java
                    samples.persistence.management.SeedDatabase
            
Add the following line to your
                persistence.xml
                file:
                <property name="kodo.ManagementConfiguration"
                    value="local-mgmt"/>
            
Run the sample program which will bring up Kodo's management
                console upon initialization:
                java
                    samples.persistence.management.ManagementMain
            
The Kodo ProfilingAgent also has a JMX MBean. You can see an example
        of profiling if you turn on the ProfilingAgent by making the
        following setting in your
        persistence.xml
        file:
    
                <property name="kodo.ManagementConfiguration"
                    value="local-mgmt-prof"/>
            
The
        Dog
        class includes a field
        collar
        which has been marked as a
        lazily loaded field. After seeing the profiling data, you may want to
        enable
        eager fetching on the field to see how the performance profile changes.
        Edit
        Dog.java
        and change the
        @OneToOne
        annotation fetch attribute
        to
        FetchType.EAGER. Recompile and reenhance
        Dog
        and run the sample again
        to see the changes.
    
Note that the Kodo data cache also has a JMX MBean. You can see an
        example of cache management if you turn on the data cache by adding the
        following settings to your
        persistence.xml
        file:
    
                <property name="kodo.DataCache"
                    value="true"/>
            
                <property name="kodo.RemoteCommitProvider"
                    value="sjvm"/>
            
Kodo's management and profiling tools can be used in a wide range of
        modes and environments. For example, by setting the
        kodo.ManagementConfiguration
        setting to
        profiling-gui
        , you can use the profiling tool exclusively.
        You can have Kodo connect and integrate with your existing JMX
        configuration
        such as provided by your application server or products such as
        MX4J.
        For further details on configuring Kodo management and profiling tools,
        see Chapter 12, Management and Monitoring.
    
To extend Kodo's monitoring abilities to your own code, you can use
        TimeWatch.
        An example of how to use the TimeWatch can be found in
        QueryThread.java.
        A TimeWatch allows for monitoring of named code blocks.
    
|    |