db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: jakarta-ojb/xdocs/stylesheets site.xsl
Date Sat, 21 Dec 2002 16:17:34 GMT
arminw      2002/12/21 08:17:34

  Modified:    xdocs    tutorial4.xml quickstart.xml faq.xml tutorial1.xml
                        tutorial3.xml jdbc-types.xml query.xml
                        tutorial2.xml
               xdocs/stylesheets site.xsl
  Log:
  improve view of the sides - avoid scrolling
  
  Revision  Changes    Path
  1.8       +205 -205  jakarta-ojb/xdocs/tutorial4.xml
  
  Index: tutorial4.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/xdocs/tutorial4.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- tutorial4.xml	17 Dec 2002 20:48:55 -0000	1.7
  +++ tutorial4.xml	21 Dec 2002 16:17:34 -0000	1.8
  @@ -14,7 +14,7 @@
   <subsection name="Introduction">
   
   <p>
  -  This document demonstrates how to use ObjectRelationalBridge an the JDO API 
  +  This document demonstrates how to use ObjectRelationalBridge an the JDO API
     in a simple application scenario. The tutorial application implements a
     product catalog database with some basic use cases. The source code for the
     tutorial application is shipped with the OJB source distribution and resides
  @@ -28,13 +28,13 @@
     The present document explains these modifications.
   </p>
   <p>
  -  This document is not meant as a complete introduction to JDO.  
  +  This document is not meant as a complete introduction to JDO.
     For more information see: <A HREF="http://java.sun.com/products/jdo/">Sun's JDO site</A>.
   </p>
   <p>
   	<b>temporary note:</b> OJB does not provide it's own JDO implementation yet.
   	A full JDO implementation is in the scope of the 2.0 release.
  -	For the time being we provide a plugin to the JDO reference implementation 
  +	For the time being we provide a plugin to the JDO reference implementation
   	called <code>OjbStore</code>. The <code>OjbStore</code> plugin resides in
   	the package <code>org.apache.ojb.jdori.sql</code>.
   </p>
  @@ -45,21 +45,21 @@
   	To install and run the demo application please follow the following steps:
   	<ol>
   		<li>
  -			Download the JDO Specification and the Reference Implementation from 
  +			Download the JDO Specification and the Reference Implementation from
   			<A HREF="http://java.sun.com/products/jdo/">Sun's JDO site</A>.<br/>
  -			Extract the archives to local directories and copy the files 
  +			Extract the archives to local directories and copy the files
   			<b><code>jdori.jar</code></b>, <b><code>jdo.jar</code></b> and
   			<b><code>jdori-enhancer.jar</code></b> into the OJB <b><code>lib</code></b>
  -			directory.			
  +			directory.
   		</li>
   		<li>
   			Now compile the sources, setup the test database and perform bytecode
   			enhancement
  -		  	by executing <code>bin\build with-jdori prepare-tutorials enhance-jdori</code> 
  +		  	by executing <code>bin\build with-jdori prepare-tutorials enhance-jdori</code>
   		  	under Win32 or
   		  	<code>bin/build.sh with-jdori prepare-tutorials enhance-jdori</code> under Unix/Linux
   		  	from the ojb toplevel directory.
  -	  	</li>	  	
  +	  	</li>
   
   		<li>
   		    Now you can start the tutorial application by executing
  @@ -76,7 +76,7 @@
   <p>
   In the <A HREF="tutorial1.html">first tutorial</A> you learned
   that OJB provides three major APIs. The PersistenceBroker, the ODMG
  -implementation, and the JDO implementation. 
  +implementation, and the JDO implementation.
   </p>
   <p>
   	The first tutorial implemented the sample
  @@ -85,7 +85,7 @@
   	API.
   </p>
   <p>
  -	You can get more information about the JDO API at 
  +	You can get more information about the JDO API at
   	<a href="http://java.sun.com/products/jdo/javadocs/index.html" target="_blank">
   	http://java.sun.com/products/jdo/javadocs/index.html</a>.
   </p>
  @@ -94,16 +94,16 @@
   In order to access the functionalities of the JDO API you have to
   deal with a special facade object that serves as the main entry point
   to all JDO operations. This facade is specified by the Interface
  -<code>javax.jdo.PersistenceManager.</code> 
  +<code>javax.jdo.PersistenceManager.</code>
   
   A Vendor of an JDO compliant product must provide a specific
   implementation of the <code>javax.jdo.PersistenceManager</code>
  -interface. JDO also specifies that a JDO implementation must provide a 
  -<code>javax.jdo.PersistenceManagerFactory</code> implementation that is 
  -responsible for generating <code>javax.jdo.PersistenceManager</code> 
  +interface. JDO also specifies that a JDO implementation must provide a
  +<code>javax.jdo.PersistenceManagerFactory</code> implementation that is
  +responsible for generating <code>javax.jdo.PersistenceManager</code>
   instances.
   So if you know how to use the JDO API you only have to learn how to obtain
  -the OJB specific PersistenceManagerFactory object. Ideally this will be 
  +the OJB specific PersistenceManagerFactory object. Ideally this will be
   the only vendor specific operation.
   </p>
   <p>
  @@ -113,31 +113,31 @@
   </p>
   
   <source><![CDATA[
  -    public Application()
  +public Application()
  +{
  +    factory = null;
  +    manager = null;
  +    try
       {
  -    	factory = null;
  -        manager = null;
  -        try
  -        {
  -            // create OJB specific factory:
  -            factory = new OjbStorePMF();
  -        }
  -        catch (Throwable t)
  -        {
  -            System.out.println("ERROR: " + t.getMessage());
  -            t.printStackTrace();
  -        }
  -        useCases = new Vector();
  -        useCases.add(new UCListAllProducts(factory));
  -        useCases.add(new UCEnterNewProduct(factory));
  -        useCases.add(new UCEditProduct(factory));
  -        useCases.add(new UCDeleteProduct(factory));
  -        useCases.add(new UCQuitApplication(factory));
  +        // create OJB specific factory:
  +        factory = new OjbStorePMF();
       }
  +    catch (Throwable t)
  +    {
  +        System.out.println("ERROR: " + t.getMessage());
  +        t.printStackTrace();
  +    }
  +    useCases = new Vector();
  +    useCases.add(new UCListAllProducts(factory));
  +    useCases.add(new UCEnterNewProduct(factory));
  +    useCases.add(new UCEditProduct(factory));
  +    useCases.add(new UCDeleteProduct(factory));
  +    useCases.add(new UCQuitApplication(factory));
  +}
   ]]></source>
   <p>
   The class <code>org.apache.ojb.jdori.sql.OjbStorePMF</code> is
  -the OJB specific <code>javax.jdo.PersistenceManagerFactory</code> 
  +the OJB specific <code>javax.jdo.PersistenceManagerFactory</code>
   implementation.
   </p>
   <p>
  @@ -159,12 +159,12 @@
   <p>
   	In the use case <code>UCListAllProducts</code>
   	we have to retrieve a collection containing all product entries from
  -	the persistent store. 
  -	
  +	the persistent store.
  +
   	To retrieve a collection containing objects
   	matching some criteria we can use the JDOQL query language as
  -	specified by the JDO spec. 
  -	
  +	specified by the JDO spec.
  +
   	In our use case we want to select <I>all</I> persistent instances
   	of the class Products. In this case the query is quite simple as it
   	does not need any limiting search criteria.
  @@ -172,7 +172,7 @@
   <p>
   	We use the factory to create a PersistenceManager instance in step one.
   	In the second step we ask the PersistenceManager to create a query
  -	returning all Product instances.	
  +	returning all Product instances.
   </p>
   
   <p>
  @@ -184,47 +184,47 @@
   	each product matching our query.
   </p>
   <source><![CDATA[
  -    public void apply()
  -    {
  -    public void apply()
  -    {
  -        // 1. get a PersistenceManager instance 
  -        PersistenceManager manager = factory.getPersistenceManager();
  -        System.out.println("The list of available products:");
  +public void apply()
  +{
  +    // 1. get a PersistenceManager instance
  +    PersistenceManager manager = factory.getPersistenceManager();
  +    System.out.println("The list of available products:");
   
  -        try
  -        {
  -            // clear cache to provoke query against database
  -            PersistenceBrokerFactory.defaultPersistenceBroker().clearCache();
  -        	
  -            // 2. start tx and form query
  -            manager.currentTransaction().begin();
  -            Query query = manager.newQuery(Product.class);
  -
  -            // 3. perform query
  -            Collection allProducts = (Collection)query.execute(); 
  -            
  -            // 4. now iterate over the result to print each product and finish tx
  -            java.util.Iterator iter = allProducts.iterator();
  -            if (! iter.hasNext())
  -            {
  -            	System.out.println("No Product entries found!");	
  -            }
  -            while (iter.hasNext())
  -            {
  -                System.out.println(iter.next());
  -            }
  -            manager.currentTransaction().commit();
  -        }
  -        catch (Throwable t)
  +    try
  +    {
  +        // clear cache to provoke query against database
  +        PersistenceBrokerFactory.
  +                    defaultPersistenceBroker().clearCache();
  +
  +        // 2. start tx and form query
  +        manager.currentTransaction().begin();
  +        Query query = manager.newQuery(Product.class);
  +
  +        // 3. perform query
  +        Collection allProducts = (Collection)query.execute();
  +
  +        // 4. now iterate over the result to print each
  +        // product and finish tx
  +        java.util.Iterator iter = allProducts.iterator();
  +        if (! iter.hasNext())
           {
  -            t.printStackTrace();
  +            System.out.println("No Product entries found!");
           }
  -        finally
  +        while (iter.hasNext())
           {
  -        	manager.close();	
  +            System.out.println(iter.next());
           }
  +        manager.currentTransaction().commit();
  +    }
  +    catch (Throwable t)
  +    {
  +        t.printStackTrace();
  +    }
  +    finally
  +    {
  +        manager.close();
       }
  +}
   ]]></source>
   
   </subsection>
  @@ -258,34 +258,34 @@
   	appropriate persistence operation on commit.
   </p>
   <source><![CDATA[
  -    public void apply()
  -    {
  -        // 1. this will be our new object
  -        Product newProduct = new Product();
  -        // 2. now read in all relevant information and fill the new object:
  -        System.out.println("please enter a new product");
  -        String in = readLineWithMessage("enter name:");
  -        newProduct.setName(in);
  -        in = readLineWithMessage("enter price:");
  -        newProduct.setPrice(Double.parseDouble(in));
  -        in = readLineWithMessage("enter available stock:");
  -        newProduct.setStock(Integer.parseInt(in));
  -
  -        // 3. create PersistenceManager and start transaction
  -        PersistenceManager manager = factory.getPersistenceManager();
  -        
  -        Transaction tx = null;
  -        tx = manager.currentTransaction();
  -        tx.begin();
  +public void apply()
  +{
  +    // 1. this will be our new object
  +    Product newProduct = new Product();
  +    // 2. now read in all relevant information and fill the new object:
  +    System.out.println("please enter a new product");
  +    String in = readLineWithMessage("enter name:");
  +    newProduct.setName(in);
  +    in = readLineWithMessage("enter price:");
  +    newProduct.setPrice(Double.parseDouble(in));
  +    in = readLineWithMessage("enter available stock:");
  +    newProduct.setStock(Integer.parseInt(in));
  +
  +    // 3. create PersistenceManager and start transaction
  +    PersistenceManager manager = factory.getPersistenceManager();
  +
  +    Transaction tx = null;
  +    tx = manager.currentTransaction();
  +    tx.begin();
   
  -        // 4. mark object as persistent
  -        manager.makePersistent(newProduct);
  -        
  -        // 5. commit transaction
  -        tx.commit();
  -        
  -        manager.close();
  -    }
  +    // 4. mark object as persistent
  +    manager.makePersistent(newProduct);
  +
  +    // 5. commit transaction
  +    tx.commit();
  +
  +    manager.close();
  +}
   ]]></source>
   
   </subsection>
  @@ -294,84 +294,85 @@
   <p>
   	The UseCase <code>UCEditProduct</code>
   	allows the user to select one of the existing products and to edit
  -	it. 
  -</p>	
  -<p>	
  +	it.
  +</p>
  +<p>
   	The user enters the products unique id.
   	The object to be edited is looked up by this id. (Steps 1. and 2.)
   	This lookup is necessary as our
   	application does not hold a list of all product objects.
  -</p> 
  -<p>	
  +</p>
  +<p>
   	The product is then edited (Step 3.).
   </p>
   <p>
   	In step four the transaction is commited. All changes to objects
  -	touched by the transaction are now made persistent. 
  +	touched by the transaction are now made persistent.
       Because we modified an existing object an update operation is
       performed against the backend database.
   </p>
   <source><![CDATA[
  -    public void apply()
  -    {
  -    	PersistenceManager manager = null;
  -        String in = readLineWithMessage("Edit Product with id:");
  -        int id = Integer.parseInt(in);
  +public void apply()
  +{
  +    PersistenceManager manager = null;
  +    String in = readLineWithMessage("Edit Product with id:");
  +    int id = Integer.parseInt(in);
   
  -        // We don't have a reference to the selected Product.
  -        // So first we have to lookup the object,
  +    // We don't have a reference to the selected Product.
  +    // So first we have to lookup the object,
   
  -        Product toBeEdited;
  -        try
  -        {
  -            manager = factory.getPersistenceManager();
  -			
  -            // 1. create Identity representing the instance to edit.
  -            Product example = new Product();
  -            example.setId(id);
  -            Identity oid = new Identity(example);
  -            
  -            // 2. start tx and retrieve instance by identity lookup
  -            manager.currentTransaction().begin();
  -            toBeEdited = (Product) manager.getObjectById(oid, false);
  -            if (toBeEdited == null)
  -            {
  -            	System.out.println("did not find a matching instance...");
  -            	manager.currentTransaction().rollback();
  -            	return;	
  -            }
  -            
  -            // 3. edit the existing entry
  -            System.out.println("please edit the product entry");
  -            in =
  -                readLineWithMessage(
  -                    "enter name (was " + toBeEdited.getName() + "):");
  -            toBeEdited.setName(in);
  -            in =
  -                readLineWithMessage(
  -                    "enter price (was " + toBeEdited.getPrice() + "):");
  -            toBeEdited.setPrice(Double.parseDouble(in));
  -            in =
  -                readLineWithMessage(
  -                    "enter available stock (was "
  -                        + toBeEdited.getStock()
  -                        + "):");
  -            toBeEdited.setStock(Integer.parseInt(in));
  +    Product toBeEdited;
  +    try
  +    {
  +        manager = factory.getPersistenceManager();
   
  -            // 4. commit transaction. changes to toBeEdited are made persistent
  -            manager.currentTransaction().commit();
  -        }
  -        catch (Throwable t)
  +        // 1. create Identity representing the instance to edit.
  +        Product example = new Product();
  +        example.setId(id);
  +        Identity oid = new Identity(example);
  +
  +        // 2. start tx and retrieve instance by identity lookup
  +        manager.currentTransaction().begin();
  +        toBeEdited = (Product) manager.getObjectById(oid, false);
  +        if (toBeEdited == null)
           {
  -            // rollback in case of errors
  +            System.out.println("did not find a matching instance...");
               manager.currentTransaction().rollback();
  -            t.printStackTrace();
  -        }
  -        finally 
  -        {
  -        	manager.close();	
  +            return;
           }
  +
  +        // 3. edit the existing entry
  +        System.out.println("please edit the product entry");
  +        in =
  +            readLineWithMessage(
  +                "enter name (was " + toBeEdited.getName() + "):");
  +        toBeEdited.setName(in);
  +        in =
  +            readLineWithMessage(
  +                "enter price (was " + toBeEdited.getPrice() + "):");
  +        toBeEdited.setPrice(Double.parseDouble(in));
  +        in =
  +            readLineWithMessage(
  +                "enter available stock (was "
  +                    + toBeEdited.getStock()
  +                    + "):");
  +        toBeEdited.setStock(Integer.parseInt(in));
  +
  +        // 4. commit transaction. changes to toBeEdited are made
  +        // persistent
  +        manager.currentTransaction().commit();
  +    }
  +    catch (Throwable t)
  +    {
  +        // rollback in case of errors
  +        manager.currentTransaction().rollback();
  +        t.printStackTrace();
       }
  +    finally
  +    {
  +        manager.close();
  +    }
  +}
   ]]></source>
   
   </subsection>
  @@ -380,7 +381,7 @@
   <p>
   	The UseCase <code>UCDeleteProduct</code>
   	allows the user to select one of the existing products and to delete
  -	it from the persistent storage. 
  +	it from the persistent storage.
   </p>
   <p>
   	The user enters the products unique id.
  @@ -389,63 +390,62 @@
   	application does not hold a list of all product objects.
   </p>
   <p>
  -	In the third step we ask the PersistenceManager to 
  +	In the third step we ask the PersistenceManager to
   	delete the persistent object.
   </p>
   <p>
   	In the last step we commit the transaction. All changes to objects
  -	touched by the transaction are now made persistent. 
  +	touched by the transaction are now made persistent.
       Because we marked an existing object for deletion, a delete operation is
       performed against the backend database.
   </p>
   
   <source><![CDATA[
  -    public void apply()
  +public void apply()
  +{
  +    PersistenceManager manager = null;
  +    String in = readLineWithMessage("Delete Product with id:");
  +    int id = Integer.parseInt(in);
  +
  +    // We don't have a reference to the selected Product.
  +    // 1. build an Identity representing the instance in question
  +    Product example = new Product();
  +    example.setId(id);
  +    Identity oid = new Identity(example);
  +    try
       {
  -    	PersistenceManager manager = null;
  -        String in = readLineWithMessage("Delete Product with id:");
  -        int id = Integer.parseInt(in);
  +        // 2. obtain PM, start tx and perform identity lookup
  +        manager = factory.getPersistenceManager();
   
  -        // We don't have a reference to the selected Product.
  -        // 1. build an Identity representing the instance in question
  -        Product example = new Product();
  -        example.setId(id);
  -        Identity oid = new Identity(example);
  -        try
  +        // start transaction
  +        Transaction tx = null;
  +        // open transaction
  +        tx = manager.currentTransaction();
  +        tx.begin();
  +
  +        Product toBeDeleted =
  +            (Product) manager.getObjectById(oid, false);
  +        if (toBeDeleted == null)
           {
  -            // 2. obtain PM, start tx and perform identity lookup
  -            manager = factory.getPersistenceManager();
  -            
  -            // start transaction
  -            Transaction tx = null;
  -            // open transaction
  -            tx = manager.currentTransaction();
  -            tx.begin();
  -
  -            Product toBeDeleted =
  -                (Product) manager.getObjectById(oid, false);
  -            if (toBeDeleted == null)
  -            {
  -            	System.out.println("did not find a matching instance...");
  -            	tx.rollback();
  -            	return;	
  -            }
  -            // 3. mark object as deleted
  -            manager.deletePersistent(toBeDeleted);
  -
  -            // commit transaction. A DELETE statement is generated and executed to
  -            // remove toBeDeleted from the database
  -            tx.commit();
  -            manager.close();
  +            System.out.println("did not find a matching instance...");
  +            tx.rollback();
  +            return;
           }
  -        catch (Throwable t)
  -        {
  -            // rollback in case of errors
  -            manager.currentTransaction().rollback();
  -            t.printStackTrace();
  -        }
  -    }
  +        // 3. mark object as deleted
  +        manager.deletePersistent(toBeDeleted);
   
  +        // commit transaction. A DELETE statement is generated
  +        // and executed to remove toBeDeleted from the database
  +        tx.commit();
  +        manager.close();
  +    }
  +    catch (Throwable t)
  +    {
  +        // rollback in case of errors
  +        manager.currentTransaction().rollback();
  +        t.printStackTrace();
  +    }
  +}
   ]]></source>
   
   </subsection>
  
  
  
  1.13      +24 -21    jakarta-ojb/xdocs/quickstart.xml
  
  Index: quickstart.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/xdocs/quickstart.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- quickstart.xml	23 Aug 2002 21:04:39 -0000	1.12
  +++ quickstart.xml	21 Dec 2002 16:17:34 -0000	1.13
  @@ -10,26 +10,26 @@
   
   <section name="Quick Start">
     <ol>
  -    <li>Be sure to have a JDK 1.2 or higher installed ! 
  -    <br/> The environment variable <CODE><B>JAVA_HOME</B></CODE> must point to the 
  +    <li>Be sure to have a JDK 1.2 or higher installed !
  +    <br/> The environment variable <CODE><B>JAVA_HOME</B></CODE> must point to the
   	  base directory of your JDK.  For example:
   	  <source><![CDATA[
  -set JAVA_HOME=C:\jdk1.3     
  +set JAVA_HOME=C:\jdk1.3
   	  ]]></source>
       </li>
       <li>
  -      Unpack the latest <code>jakarta-ojb-XXX-src.tgz</code> (source) or 
  -      <code>jakarta-ojb-XXX.tgz</code> (binary) snapshot to a directory 
  +      Unpack the latest <code>jakarta-ojb-XXX-src.tgz</code> (source) or
  +      <code>jakarta-ojb-XXX.tgz</code> (binary) snapshot to a directory
         <code>&lt;path&gt;</code> of your choice.
  -      A directory <code>&lt;path&gt;/jakarta-ojb-XXX</code> 
  -      containing the unpacked source or binary distribution 
  +      A directory <code>&lt;path&gt;/jakarta-ojb-XXX</code>
  +      containing the unpacked source or binary distribution
         will be created.
       </li>
       <li>
         In a terminal window (or dos box under Win32) change to this directory
         <code>&lt;path&gt;/jakarta-ojb-XXX</code>.
  -      
  -      <BR/>      
  +
  +      <BR/>
         Under linux/Unix it may be neccessary to grant execution permission to the shell scripts
         by <code>chmod u+x bin/*.sh</code>.
       </li>
  @@ -37,32 +37,35 @@
       <li>
         To check if OJB runs properly out of the box execute
   	  <b><code>bin\build junit</code></b> under Win32 and
  -	  <b><code>bin/build.sh junit</code></b> under Unix/Linux. 
  +	  <b><code>bin/build.sh junit</code></b> under Unix/Linux.
   	  <br/>
   	  This will launch the OJB regression test suite. If all
   	  tests are passed the console output looks like follows:
         <source><![CDATA[
   junit:
       [junit] Running org.apache.ojb.broker.AllTests
  -    [junit] [BOOT] INFO: OJB.properties: file:<path>/jakarta-ojb-XXX/target/test/ojb/OJB.properties
  +    [junit] [BOOT] INFO: OJB.properties: file:
  +    <path>/jakarta-ojb-XXX/target/test/ojb/OJB.properties
       [junit] Tests run: 115, Failures: 0, Errors: 0, Time elapsed: 11,023 sec
       [junit] Running org.apache.ojb.odmg.AllTests
  -    [junit] [BOOT] INFO: OJB.properties: file:<path>/jakarta-ojb-XXX/target/test/ojb/OJB.properties
  +    [junit] [BOOT] INFO: OJB.properties: file:
  +    <path>/jakarta-ojb-XXX/target/test/ojb/OJB.properties
       [junit] Tests run: 122, Failures: 0, Errors: 0, Time elapsed: 14,876 sec
       [junit] Running org.apache.ojb.soda.AllTests
  -    [junit] [BOOT] INFO: OJB.properties: file:<path>/jakarta-ojb-XXX/target/test/ojb/OJB.properties
  +    [junit] [BOOT] INFO: OJB.properties: file:
  +    <path>/jakarta-ojb-XXX/target/test/ojb/OJB.properties
       [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 6,417 sec
         ]]>
  -      </source>	
  -      
  +      </source>
  +
         <p>
         	It is of course possible to use ANT directly instead of our build scripts.
         	If you want to do this you have to place <code>xalan.jar</code> and <code>junit.jar</code>
         	into the ANT lib directory.
  -      </p>  
  +      </p>
   
       </li>
  -        
  +
       <li>
         have a look at the tutorials to learn how to use OJB: <a href="tutorial1.html">tutorial1</a>,
         <a href="tutorial2.html">tutorial2</a>, <a href="tutorial3.html">tutorial3</a>
  @@ -74,13 +77,13 @@
          please see <a href="platforms.html">this document</a>.
       </li>
   
  -    
  +
       <li>
         deployment of OJB within your application is described <a href="deployment.html">here</a>.
       </li>
  -    
  -    
  -    
  +
  +
  +
     </ol>
   </section>
   
  
  
  
  1.11      +105 -104  jakarta-ojb/xdocs/faq.xml
  
  Index: faq.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/xdocs/faq.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- faq.xml	8 Dec 2002 12:01:04 -0000	1.10
  +++ faq.xml	21 Dec 2002 16:17:34 -0000	1.11
  @@ -13,11 +13,11 @@
      <ul>
       <li><a href="#1">Help! I'm having problems installing and using OJB!</a></li>
       <li><a href="#2">Help! I still have serious problems installing OJB!</a></li>
  -    <li><a href="#3">Why OJB? Why do we need another O/R mapping tool?</a></li>       
  +    <li><a href="#3">Why OJB? Why do we need another O/R mapping tool?</a></li>
       <li><a href="#4">Does OJB support my RDBMS?</a></li>
       <li><a href="#5">How to use OJB with my RDBMS?</a></li>
       <li><a href="#6">How to page and sort?</a></li>
  -    <li><a href="#7">What about performance and memory usage if thousands of objects matching a query are returned as a Collection?</a></li>   
  +    <li><a href="#7">What about performance and memory usage if thousands of objects matching a query are returned as a Collection?</a></li>
       <li><a href="#8">How is OJB related to ODMG and JDO?</a></li>
       <li><a href="#9">What are the differences between the PersistenceBroker API and the ODMG API? Which one should I use in my applications?</a></li>
       <li><a href="#10">What are the OJB internal tables for?</a></li>
  @@ -28,18 +28,18 @@
       <li><a href="#15">I don't like OQL, can I use the PersistenceBroker Queries within ODMG?</a></li>
       <li><a href="#16">The OJB JDO implementation is not finished, how can I start using OJB?</a></li>
      </ul>
  - 
  -   <subsection name="Help! I'm having problems installing and using OJB!" anchor="1">	
  +
  +   <subsection name="Help! I'm having problems installing and using OJB!" anchor="1">
       <p>
        Please read the <a href="quickstart.html">OJB Quick Start</a> document. OJB is a
        powerful and complex system - installing and configuring OJB is not a trivial task.
        Be sure to follow <b>all the steps</b> mentioned in that document - don't skip any steps
  -     when first installing OJB on your systems.  
  +     when first installing OJB on your systems.
       </p>
       <p>
  -     If you are having problems running OJB against your target database, read the 
  +     If you are having problems running OJB against your target database, read the
        respective <a href="platforms.html">platform documentation</a>.  Before you
  -     try to deploy OJB to your environment, read the 
  +     try to deploy OJB to your environment, read the
        <a href="deployment.html">deployment guide</a>.
       </p>
      </subsection>
  @@ -55,7 +55,7 @@
   	 and I could show you stuff I wrote that I know you wouldn't understand.
   	 I'll just break it down the best I can on what, where and why.
       </p>
  -    <p>	
  +    <p>
   	 OJB is a data persistence layer for Java. I'll just use an example of how I
   	 use it. I have an RDMS. I would like to save Java object states to this
   	 database and I would like to be able to search this information as well. If
  @@ -72,7 +72,7 @@
   	 except it's the SUN JDO standard. I use ODMG because the JDO interface is
   	 not ready yet.
       </p>
  -    <p>	
  +    <p>
   	 OJB is easy to use. I'll just break it down into two sides. There's the
   	 side your writing your code for your application and there's the side that
   	 you configure to make OJB connect to your database. Starting with your
  @@ -84,7 +84,7 @@
   	 tables for OJB and you will define the classes you wish to store in your
   	 database.
       </p>
  -    <p>	
  +    <p>
   	 First thing to do is to build the cvs's with the default database HSQL,
   	 because you know it will work. If you get past this point you should have a
   	 working OJB compiled. Now if your using JDK 1.4 you will need to set in
  @@ -95,14 +95,14 @@
   	 will need a couple other jars in you /lib directory to make it all work.
   	 See this page for those. http://jakarta.apache.org/ojb/deployment.html
       </p>
  -    <p>	
  +    <p>
   	 Next you will need some xml and configuration files in your class path for
   	 OJB. You will find those files under {$OJB_base_dir}/target/test/ojb. All
   	 the repository.xml's and OJB.properties for sure. With all these files in
   	 place with your application you should be ready to use OJB and start
   	 writing your application.
       </p>
  -    <p>	
  +    <p>
    	 Finally you will want to setup your connection to your database and define
   	 your classes you will be storing in your database. In the repository.xml
   	 file you can configure your JDBC parameters so OJB can connect to your
  @@ -112,14 +112,14 @@
   	 will want to comment out the junit part in repository.xml because it's just
   	 for testing.
       </p>
  -    <p>	
  +    <p>
    	 The final thing to do is to make sure the OJB core tables are in your
   	 database. Look on this page for the core tables.
   	 http://jakarta.apache.org/ojb/platforms.html. These core tables are used by
   	 OJB to store internal data while it's running. It needs these. Then there's
   	 the tables you define. The ones you mapped in the repository_user.xml file.
       </p>
  -    <p>	
  +    <p>
    	 Sorry if any of this is off. OJB is growing so fast that it's hard to keep
   	 up with all changes. The order I gave the steps in is just how I would
   	 think it's understood better. You can go in any order you want. The steps
  @@ -165,7 +165,7 @@
          It has a modular architecture (you can quite easily reuse	some components
          in your own applications if you don't want to use	the whole thing:
          <ul>
  -        <li>The PersistenceBroker (e.g. to build your own PersistenceManager)</li> 
  +        <li>The PersistenceBroker (e.g. to build your own PersistenceManager)</li>
           <li>The Query Interface as an abstract query syntax</li>
           <li>The OQL Parser</li>
           <li>The MetaData Layer</li>
  @@ -176,7 +176,7 @@
          It has a very sharp focus: It's concerned with O/R mapping and nothing
          else.
         </li>
  -     </ul>  
  +     </ul>
   
        Before making OJB an OpenSource project I had a look around at the
        emerging OpenSource O/R scene and was asking myself if there is
  @@ -198,19 +198,19 @@
         </li>
        </ul>
       </p>
  -   </subsection> 
  +   </subsection>
   
      <subsection name="Does OJB support my RDBMS?" anchor="4">
       <p>
        <A HREF="platforms.html">please refer to this document</A>.
       </p>
  -   </subsection> 
  +   </subsection>
   
      <subsection name="How to use OJB with my RDBMS?" anchor="5">
       <p>
        <A HREF="platforms.html">please refer to this document</A>.
       </p>
  -   </subsection> 
  +   </subsection>
   
      <subsection name="How to page and sort?" anchor="6">
       <p>
  @@ -229,7 +229,7 @@
        You can easily implement your partial display of result data by using an
        Iterator as returned by ojb.broker.PersistenceBroker::getIteratorByQuery(...).
       </p>
  -   </subsection> 
  +   </subsection>
   
      <subsection name="What about performance and memory usage if thousands of
       objects matching a query are returned as a Collection?" anchor="7">
  @@ -262,20 +262,20 @@
        also work for VERY large resultsets, as there are no references to
        result objects that would prevent their garbage collectability.
       </p>
  -   </subsection> 
  +   </subsection>
   
      <subsection name="How is OJB related to ODMG and JDO?" anchor="8">
       <p>
        ODMG is a standard API for Object Persistence specified by the ODMG
  -     consortium (www.odmg.org). 
  +     consortium (www.odmg.org).
        JDO is Sun's API specification for Object Persistence. ODMG may
        well be regarded as a Precursor to JDO.
        In fact JDO incorporates
        many ideas from ODMG and several people who have been involved in
        the ODMG spec are now in the JDO team.
  -     <br/>    
  +     <br/>
        I assume JDO will have
  -     tremendous influence on OODBMS-, RDBMS-, J2EE-server and O/R-tool-vendors 
  +     tremendous influence on OODBMS-, RDBMS-, J2EE-server and O/R-tool-vendors
        to provide compliant products.
        <br/>
        OJB wants to provide first class support for JDO and ODMG APIs.
  @@ -292,22 +292,22 @@
          This API can also be used directly by applications that don't need full
          fledged object level transactions (see <a href="tutorial1.html">
          tutorial1</a> for details).
  -      </li> 
  +      </li>
   
         <li>
          An Object Transaction Manager (OTM) layer that contains all features that
          JDO and ODMG have in common as Object level transactions, lock-management,
          instance lifecyle etc.
          (See <a href="jdo-proposal.html">jdo-proposal.html</a> for details.)
  -       The OTM is work in progress. 
  +       The OTM is work in progress.
         </li>
  -       
  +
         <li>
          A full featured <b>ODMG 3.0</b> compliant API. (See <a href="tutorial2.html">
          tutorial2</a> for an introduction.)
          <br/> Currently this API is implemented on top the PersistenceBroker. Once the
          OTM layer is finished ODMG will be implemented on top of OTM.
  -      </li> 
  +      </li>
   
         <li>
          A <b>JDO</b> compliant API. This is work in progress.
  @@ -316,10 +316,10 @@
          <br/> Currently this API is implemented on top the PersistenceBroker. Once the
          OTM layer is finished JDO will be implemented on top of OTM.
         </li>
  -           
  +
        </ol>
       </p>
  -  
  +
       <p>
        The following graphics shows the layering of these APIs. Please note that the
        layers coloured in yellow are not yet implemented.
  @@ -327,7 +327,7 @@
      	  <img src="images/ojb-layers.png"/>
        </center>
       </p>
  -  
  +
      </subsection>
   
      <subsection name="What are the differences between the PersistenceBroker API and
  @@ -396,7 +396,7 @@
        you have to do all management things (locking, tracking objects
        state, object transactions) on your own.
       </p>
  -   </subsection>  
  +   </subsection>
   
      <subsection name="What are the OJB internal tables for?" anchor="10">
       <p>
  @@ -429,10 +429,10 @@
        subject&quot; by OID and delegates the method call to it.
       </p>
       <p>
  -     have a look at <A HREF="tutorial3.html">tutorial3.html</A>. 
  +     have a look at <A HREF="tutorial3.html">tutorial3.html</A>.
        This document has a large section on proxies.
       </p>
  -   </subsection> 
  +   </subsection>
   
      <subsection name="How can I convert data between RDBMS and OJB?" anchor="12">
       <p>
  @@ -448,24 +448,25 @@
   
   
      <subsection name="How can I trace and/or profile SQL statements executed by OJB?" anchor="13">
  -    <p> 
  +    <p>
      	 OJB  ships with out of the box support for P6Spy.
  -	 P6Spy is a JDBC proxy. It delegates all JDBC calls to the 
  +	 P6Spy is a JDBC proxy. It delegates all JDBC calls to the
   	 real JDBC driver and traces all calls to a log file.
       </p>
  -    <p> 
  - 	 In the file <code>build.properties</code> you have to set the switch 
  +    <p>
  + 	 In the file <code>build.properties</code> you have to set the switch
   	 <code>useP6Spy</code> to <code>true</code> in order to activate it:
       </p>
       <source>
  -# The useP6Spy switch determines if the tracing JDBC driver P6Spy is used.
  +# The useP6Spy switch determines if the tracing JDBC driver P6Spy
  +# is used.
   # If you enable this switch, you must also edit the file
   # jakarta-ojb/src/test/org/apache/ojb/spy.properties
   # to tell P6Spy which JDBC driver to use and where to write the log.
   # By default the HSQLDB driver is used.
   useP6Spy=true
       </source>
  -    <p> 
  +    <p>
   	 This setup uses P6Spy to trace and profile all executed
   	 SQL to a file <code>target/test/ojb/spy.log</code>.
   	 It also measures the time needed to execute each statement!
  @@ -478,114 +479,114 @@
   	 repository_user.xml file.
   	 OJB does the rest!
       </p>
  -    <p>		
  +    <p>
   	 Please refer to <a href="tutorial3.html">tutorial3</a> and
   	 <a href="repository.html">repository.html</a> for details.
       </p>
      </subsection>
   
      <subsection name="I don't like OQL, can I use the PersistenceBroker Queries within ODMG?" anchor="15">
  -    <p>	
  +    <p>
   	 Yes you can! The ODMG implementation relies on PB Queries internally!
   	 Several users (including myself) are doing this.
       </p>
  -    <p>	
  -	 If you have a look at the <code>execute()</code> method in <code>org.apache.ojb.odmg.oql.OqlQueryImpl</code> 
  +    <p>
  +	 If you have a look at the <code>execute()</code> method in <code>org.apache.ojb.odmg.oql.OqlQueryImpl</code>
   	 you will see how OJB Query objects can be used withing ODMG transactions.
  -	 The most important thing is to lock all objects returned by a query to the current transaction. 
  +	 The most important thing is to lock all objects returned by a query to the current transaction.
       </p>
       <source>
  -    public Object execute() throws org.odmg.QueryException
  +public Object execute() throws org.odmg.QueryException
  +{
  +    try
       {
  -        try
  -        {
  -            //obtain current ODMG transaction
  -            Transaction tx = OJBFactory.getInstance().currentTransaction();
  -            
  -            ...
  -
  -            // obtain a broker instance from the current transaction
  -            PersistenceBroker broker = ((HasBroker) tx).getBroker();
  -
  -            broker.beginTransaction();
  -            // ask the broker to perfom the query.
  -            // the concrete result type is configurable
  -            ManageableCollection result =
  -                (ManageableCollection) broker.getCollectionByQuery(
  -                    this.getCollectionClass(),
  -                    query);
  -            broker.commitTransaction();
  -
  -            // read-lock all resulting objects to the current transaction
  -            Iterator iter = result.ojbIterator();
  -            Object toBeLocked = null;
  -            while (iter.hasNext())
  -            {
  -                toBeLocked = iter.next();
  -                //we can only lock objects, not attributes
  -                if (broker.hasClassDescriptor(toBeLocked.getClass()))
  -                    tx.lock(toBeLocked, Transaction.READ);
  -            }
  -            
  -            ...
  -    
  -            return result;
  -        }
  -        catch (Throwable t)
  +        //obtain current ODMG transaction
  +        Transaction tx =OJBFactory.getInstance().currentTransaction();
  +
  +        ...
  +
  +        // obtain a broker instance from the current transaction
  +        PersistenceBroker broker = ((HasBroker) tx).getBroker();
  +
  +        broker.beginTransaction();
  +        // ask the broker to perfom the query.
  +        // the concrete result type is configurable
  +        ManageableCollection result =
  +            (ManageableCollection) broker.getCollectionByQuery(
  +                this.getCollectionClass(),
  +                query);
  +        broker.commitTransaction();
  +
  +        // read-lock all resulting objects to the current transaction
  +        Iterator iter = result.ojbIterator();
  +        Object toBeLocked = null;
  +        while (iter.hasNext())
           {
  -            OJB.getLogger().error(t);
  -            throw new org.odmg.QueryException(t.getMessage());
  +            toBeLocked = iter.next();
  +            //we can only lock objects, not attributes
  +            if (broker.hasClassDescriptor(toBeLocked.getClass()))
  +                tx.lock(toBeLocked, Transaction.READ);
           }
  +
  +        ...
  +
  +        return result;
  +    }
  +    catch (Throwable t)
  +    {
  +        OJB.getLogger().error(t);
  +        throw new org.odmg.QueryException(t.getMessage());
       }
  +}
       </source>
      </subsection>
   
      <subsection name="The OJB JDO implementation is not finished, how can I start using OJB?" anchor="16">
       <p>
  - 	 I recommend to not use JDO now, but to use the existing ODMG api 
  + 	 I recommend to not use JDO now, but to use the existing ODMG api
   	 for the time being.
       </p>
  -    <p>	
  +    <p>
   	 Migrating to JDO later will be smooth if you follow the following steps.
  -	 I recommend to first divide your model layer into Activity- (or Process-) 
  +	 I recommend to first divide your model layer into Activity- (or Process-)
   	 classes and Entity classes.
       </p>
  -    <p>	
  - 	 Entity classes represent classes that must be made persistent at some 
  +    <p>
  + 	 Entity classes represent classes that must be made persistent at some
   	 point in time, say a "Customer" or a "Order" object.
   	 These persistent classes and the repsective O/R mapping in repository.xml will
   	 remain unchanged.
       </p>
  -    <p>		
  - 	 Activities are classes that perform business tasks and work upon 
  +    <p>
  + 	 Activities are classes that perform business tasks and work upon
   	 entities, e.g. "edit a Customer entry", "enter a new Order"...
   	 They implement (parts of) use cases.
       </p>
  -    <p>		
  +    <p>
   	 Activities are driving transactions against the persistent storage.
       </p>
  -    <p>	
  -	 I recommend to have a Transaction interface that your Activities can 
  -	 use. This Transaction interface can be implemented by ODMG or by JDO 
  -	 Transactions (which are quite similar). The implementation should be made 
  +    <p>
  +	 I recommend to have a Transaction interface that your Activities can
  +	 use. This Transaction interface can be implemented by ODMG or by JDO
  +	 Transactions (which are quite similar). The implementation should be made
   	 configurable to allow to switch from ODMG to JDO later.
       </p>
  -    <p>	
  -	 The most obvious difference between ODMG and JDO are the query 
  +    <p>
  +	 The most obvious difference between ODMG and JDO are the query
   	 languages: ODMG uses OQL, JDO define JDOQL.
   	 As an OO developer you won't like both of them.
  -	 I recommend to use the ojb Query objects that allow an abstract syntax 
  +	 I recommend to use the ojb Query objects that allow an abstract syntax
   	 representation of queries.
  -	 It is possible to use these queries within ODMG transactions and it will 
  +	 It is possible to use these queries within ODMG transactions and it will
   	 also be possible to use them within JDO Transactions. (this is contained in the FAQ too).
       </p>
  -    <p>		
  - 	 Using your own Transaction interface in conjunction with the OJB query 
  -	 api will provide a simple but powerful abstraction of the underlying 
  +    <p>
  + 	 Using your own Transaction interface in conjunction with the OJB query
  +	 api will provide a simple but powerful abstraction of the underlying
   	 persistence layer.
       </p>
  -    <p>		
  - 	 We are using this concept to provide an abstract layer above OJB-ODMG, 
  +    <p>
  + 	 We are using this concept to provide an abstract layer above OJB-ODMG,
   	 TopLink and LDAP servers in my company.
   	 Making it work with OJB-JDO will be easy!
       </p>
  
  
  
  1.14      +224 -210  jakarta-ojb/xdocs/tutorial1.xml
  
  Index: tutorial1.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/xdocs/tutorial1.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- tutorial1.xml	8 Dec 2002 12:01:03 -0000	1.13
  +++ tutorial1.xml	21 Dec 2002 16:17:34 -0000	1.14
  @@ -21,11 +21,11 @@
       <B><code>org.apache.ojb.tutorial1</code></B>.
     </p>
     <p>
  -    This document explains the architecture of a simple application which 
  -    uses the ObJectRelationalBridge API (PersistenceBroker) to 
  -    implement five use cases which include persistence operations (retrieval, 
  -    storage, deletion of objects). This document will also demonstrate how a 
  -    simple persistence object <code>Product</code> is mapped to a table in 
  +    This document explains the architecture of a simple application which
  +    uses the ObJectRelationalBridge API (PersistenceBroker) to
  +    implement five use cases which include persistence operations (retrieval,
  +    storage, deletion of objects). This document will also demonstrate how a
  +    simple persistence object <code>Product</code> is mapped to a table in
       a relational database.
     </p>
   </subsection>
  @@ -39,7 +39,7 @@
   
     <ol>
       <li>
  -      <b>List all Products</b> - 
  +      <b>List all Products</b> -
         display all products from the persistent store.
       </li>
       <li>
  @@ -70,7 +70,7 @@
   </subsection>
   
   <subsection name="Running the Tutorial Application">
  -  
  +
     <p>
      To execute the application described in this tutorial,
      you must prepare the tutorials from the source distribution of
  @@ -83,16 +83,16 @@
      prepare-tutorials Ant target.
     </p>
   
  -  <p> 
  +  <p>
      Unpack the OJB source distribution, make sure that your current
      working directory is the top level directory of the OJB
      distribution and run the following script:
     </p>
  -   
  +
     <ul>
      <li>On Windows 9x/NT/2000/XP:
       <ul>
  -     <li><b>Prepare the Tutorials:</b> 
  +     <li><b>Prepare the Tutorials:</b>
            <code>bin\build.bat prepare-tutorials</code></li>
        <li><b>Execute this Tutorial:</b>
            <code>bin\tutorial1.bat</code></li>
  @@ -100,9 +100,9 @@
      </li>
      <li>On Unix/Linux:
       <ul>
  -     <li><b>Prepare the Tutorials:</b> 
  +     <li><b>Prepare the Tutorials:</b>
            <code>bin/build.sh prepare-tutorials</code></li>
  -     <li><b>Execute this Tutorial:</b> 
  +     <li><b>Execute this Tutorial:</b>
            <code>bin/tutorial1.bat</code></li>
       </ul>
      </li>
  @@ -137,7 +137,7 @@
     <p>
       The <code>Application.run()</code> method runs a main event loop. The
       program waits for user input in <code>Application.selectUserCase()</code>.
  -    Once a UseCase is selected, it is executed via the 
  +    Once a UseCase is selected, it is executed via the
       <code>UseCase.apply()</code> method.  This UseCase class is a simple
       implementation of the well-known Command design pattern.</p>
     <source><![CDATA[
  @@ -156,16 +156,16 @@
       }
     ]]></source>
     <p>
  -    The UseCase interface contains two methods: <code>getDescription()</code> 
  -    and <code>apply()</code>. <code>UseCase.getDescription()</code> is used 
  -    to display a short description of the use case to the user. 
  -    This method is used in <code>Application.selectUseCase()</code> to 
  -    display each use case in a menu. <code>UseCase.apply()</code> performs 
  -    the business logic implemented by the specific implementation of 
  +    The UseCase interface contains two methods: <code>getDescription()</code>
  +    and <code>apply()</code>. <code>UseCase.getDescription()</code> is used
  +    to display a short description of the use case to the user.
  +    This method is used in <code>Application.selectUseCase()</code> to
  +    display each use case in a menu. <code>UseCase.apply()</code> performs
  +    the business logic implemented by the specific implementation of
       <code>UseCase</code>.
     </p>
     <p>
  -    Starting with the simplest use case in our application - 
  +    Starting with the simplest use case in our application -
       <code>UCQuitApplication</code>. Here is the <code>apply()</code> method
       from the quit application use case:
     </p>
  @@ -181,30 +181,30 @@
   
   <section name="Using the OJB PersistenceBroker API in the UseCase Implementations">
     <p>
  -    The code example above was trivial - there are no persistence operations 
  +    The code example above was trivial - there are no persistence operations
       involved in quitting the application.  Let's move on to a more relevant
       example - <code>UCListAllProducts</code>.
  -    This use case must retreive a <code>Collection</code> containing all 
  -    products from the database. It must then iterate over this collection 
  -    and print each product.To retreive the collection from the database we need a method from the 
  +    This use case must retreive a <code>Collection</code> containing all
  +    products from the database. It must then iterate over this collection
  +    and print each product.To retreive the collection from the database we need a method from the
       OJB API.
  -  </p> 
  -  
  +  </p>
  +
     <p><b>OJB provides three major APIs.</b></p>
  -  
  +
     <ul>
      <li>The PersistenceBroker</li>
      <li>An ODMG implementation</li>
      <li>A JDO implementation</li>
     </ul>
  -   
  +
     <p>
  -    In this first tutorial only the <b>PersistenceBroker API</b> is used as it 
  -  	is the most straightforward of the three options. Tutorial 2: 
  +    In this first tutorial only the <b>PersistenceBroker API</b> is used as it
  +  	is the most straightforward of the three options. Tutorial 2:
     	<a HREF="tutorial2.html">Using the ODMG API</a> and
  -    Tutorial 4: <a href="tutorial4.html">Using the JDO API</a> will 
  +    Tutorial 4: <a href="tutorial4.html">Using the JDO API</a> will
       implement the same application using these different methods of
  -    database access.  
  +    database access.
     </p>
     <p>
       You will find the source for the PersistenceBroker API in the
  @@ -223,24 +223,25 @@
       of the Application class to find the answer to this question.
     </p>
     <source><![CDATA[
  -    public Application()
  +public Application()
  +{
  +    PersistenceBroker broker = null;
  +    try
       {
  -        PersistenceBroker broker = null;
  -        try
  -        {
  -            broker = PersistenceBrokerFactory.createPersistenceBroker("repository.xml");
  -        }
  -        catch (Throwable t)
  -        {
  -            t.printStackTrace();
  -        }
  -
  -        useCases = new Vector();
  -        useCases.add(new UCListAllProducts(broker));
  -        useCases.add(new UCEnterNewProduct(broker));
  -        useCases.add(new UCDeleteProduct(broker));
  -        useCases.add(new UCQuitApplication(broker));
  +        broker = PersistenceBrokerFactory.
  +                    createPersistenceBroker("repository.xml");
  +    }
  +    catch (Throwable t)
  +    {
  +        t.printStackTrace();
       }
  +
  +    useCases = new Vector();
  +    useCases.add(new UCListAllProducts(broker));
  +    useCases.add(new UCEnterNewProduct(broker));
  +    useCases.add(new UCDeleteProduct(broker));
  +    useCases.add(new UCQuitApplication(broker));
  +}
     ]]></source>
     <p>
       The PersistenceBrokerFactory creates an instance of PersistenceBroker
  @@ -259,8 +260,8 @@
       retrieve a collection containing objects matching some criteria we can use
       <code>PersistenceBroker.getCollectionByQuery(Query query)</code>.
       Where <code>Query</code> is a class that allows to specify criteria like
  -    price &gt; 100 or userId == 3. In our case we want to select <I>all</I> 
  -	of the persistence objects stored in the Product table.  We need <b>no</b> 
  +    price &gt; 100 or userId == 3. In our case we want to select <I>all</I>
  +	of the persistence objects stored in the Product table.  We need <b>no</b>
   	(or <i>null</i>) filtering criteria.
     </p>
     <p>
  @@ -268,29 +269,30 @@
     </p>
   
     <source><![CDATA[
  -    public void apply()
  +public void apply()
  +{
  +    System.out.println("The list of available products:");
  +    // build a query that selects all objects of Class Product,
  +    // without any further criteria according to ODMG the
  +    // Collection containing all instances of a
  +    // persistent class is called "Extent"
  +    Query query = new QueryByCriteria(Product.class, null);
  +    try
       {
  -        System.out.println("The list of available products:");
  -        // build a query that selects all objects of Class Product, without any
  -        // further criteria according to ODMG the Collection containing all
  -        // instances of a persistent class is called "Extent"
  -        Query query = new QueryByCriteria(Product.class, null);
  -        try
  -        {
  -            // ask the broker to retrieve the Extent collection
  -            Collection allProducts = broker.getCollectionByQuery(query);
  -            // now iterate over the result to print each product
  -            java.util.Iterator iter = allProducts.iterator();
  -            while (iter.hasNext())
  -            {
  -                System.out.println(iter.next());
  -            }
  -        }
  -        catch (Throwable t)
  +        // ask the broker to retrieve the Extent collection
  +        Collection allProducts = broker.getCollectionByQuery(query);
  +        // now iterate over the result to print each product
  +        java.util.Iterator iter = allProducts.iterator();
  +        while (iter.hasNext())
           {
  -            t.printStackTrace();
  +            System.out.println(iter.next());
           }
       }
  +    catch (Throwable t)
  +    {
  +        t.printStackTrace();
  +    }
  +}
     ]]></source>
   
     <p>
  @@ -315,28 +317,29 @@
     </p>
   
     <source><![CDATA[
  -    public void apply()
  +public void apply()
  +{
  +    System.out.println("The list of available products:");
  +    // build a query that select all objects of Class Product,
  +    // without any further criteria according to ODMG
  +    // the Collection containing all
  +    // instances of a persistent class is called "Extent"
  +    Query query = new QueryByCriteria(Product.class, null);
  +    try
       {
  -        System.out.println("The list of available products:");
  -        // build a query that select all objects of Class Product, without any
  -        // further criteria according to ODMG the Collection containing all
  -        // instances of a persistent class is called "Extent"
  -        Query query = new QueryByCriteria(Product.class, null);
  -        try
  -        {
  -            // ask the broker to retrieve an Iterator
  -            java.util.Iterator iter = broker.getIteratorByQuery(query);
  -            // now iterate over the result to print each product
  -            while (iter.hasNext())
  -            {
  -                System.out.println(iter.next());
  -            }
  -        }
  -        catch (Throwable t)
  +        // ask the broker to retrieve an Iterator
  +        java.util.Iterator iter = broker.getIteratorByQuery(query);
  +        // now iterate over the result to print each product
  +        while (iter.hasNext())
           {
  -            t.printStackTrace();
  +            System.out.println(iter.next());
           }
       }
  +    catch (Throwable t)
  +    {
  +        t.printStackTrace();
  +    }
  +}
     ]]></source>
   
     <p>
  @@ -357,37 +360,37 @@
   for this task.
   </p>
     <source><![CDATA[
  -    public void apply()
  -    {
  -        // this will be our new object
  -        Product newProduct = new Product();
  -        // now read in all relevant information and fill the new object:
  -        System.out.println("please enter a new product");
  -        String in = readLineWithMessage("enter name:");
  -        newProduct.setName(in);
  -        in = readLineWithMessage("enter price:");
  -        newProduct.setPrice(Double.parseDouble(in));
  -        in = readLineWithMessage("enter available stock:");
  -        newProduct.setStock(Integer.parseInt(in));
  +public void apply()
  +{
  +    // this will be our new object
  +    Product newProduct = new Product();
  +    // now read in all relevant information and fill the new object:
  +    System.out.println("please enter a new product");
  +    String in = readLineWithMessage("enter name:");
  +    newProduct.setName(in);
  +    in = readLineWithMessage("enter price:");
  +    newProduct.setPrice(Double.parseDouble(in));
  +    in = readLineWithMessage("enter available stock:");
  +    newProduct.setStock(Integer.parseInt(in));
   
  -        // now perform persistence operations
  -        try
  -        {
  -            // 1. open transaction
  -            broker.beginTransaction();
  +    // now perform persistence operations
  +    try
  +    {
  +        // 1. open transaction
  +        broker.beginTransaction();
   
  -            // 2. make the new object persistent
  -            broker.store(newProduct);
  -            broker.commitTransaction();
  -        }
  -        catch (PersistenceBrokerException ex)
  -        {
  -            // if something went wrong: rollback
  -            broker.abortTransaction();
  -            System.out.println(ex.getMessage());
  -            ex.printStackTrace();
  -        }
  +        // 2. make the new object persistent
  +        broker.store(newProduct);
  +        broker.commitTransaction();
  +    }
  +    catch (PersistenceBrokerException ex)
  +    {
  +        // if something went wrong: rollback
  +        broker.abortTransaction();
  +        System.out.println(ex.getMessage());
  +        ex.printStackTrace();
       }
  +}
     ]]></source>
   
     <p>
  @@ -409,7 +412,7 @@
      objects, the system must first retrieve a product from persistent
      storage via the PersistenceBroker.
     </p>
  - 
  +
     <p>
      Selecting an object from the PersistenceBroker is simple - we must
      first create a QueryByCriteria object.  A QueryByCriteria object is
  @@ -418,67 +421,71 @@
      notice that all of the other properties of the Product object
      remain unpopulated. We have essentially defined a <b>filter</b> by
      populating only the "productId" property - our query will retrieve only
  -   the product that has this productId.  Instead of passing an object to the 
  -   query constructor, we could have passed a Class, and a Criteria object.  
  +   the product that has this productId.  Instead of passing an object to the
  +   query constructor, we could have passed a Class, and a Criteria object.
      Constructing a Criteria object directly allows you
      to specify an arbitrarily complex collection of query criteria such as "productId"
      must be greater than 2 and less than 5.  A complex query is demonstrated later in this
      tutorial.
     </p>
  - 
  +
     <p>
      The Product object is retrieved, with the call to
      <code>broker.getObjectByQuery(query)</code>.  This retreived object is then
      edited by setting properties based on the user input, and this
      object is then stored in the persistence storage through a call to
  -   <code>broker.store(toBeEdited)</code>.  Here is the code from 
  +   <code>broker.store(toBeEdited)</code>.  Here is the code from
      <code>UCEditProduct</code>.
     </p>
   
     <source><![CDATA[
  -    public void apply()
  +public void apply()
  +{
  +    String in = readLineWithMessage("Edit Product with id:");
  +    int id = Integer.parseInt(in);
  +
  +    // We do not have a reference to the selected Product.
  +    // So first we have to lookup the object,
  +    // we do this by a query by example (QBE):
  +    // 1. build an example object with matching primary key values:
  +    Product example = new Product();
  +    example.setId(id);
  +
  +    // 2. build a QueryByCriteria from this sample instance:
  +    Query query = new QueryByCriteria(example);
  +    try
       {
  -        String in = readLineWithMessage("Edit Product with id:");
  -        int id = Integer.parseInt(in);
  -
  -        // We do not have a reference to the selected Product.
  -        // So first we have to lookup the object,
  -        // we do this by a query by example (QBE):
  -        // 1. build an example object with matching primary key values:
  -        Product example = new Product();
  -        example.setId(id);
  +        // 3. start broker transaction
  +        broker.beginTransaction();
   
  -        // 2. build a QueryByCriteria from this sample instance:
  -        Query query = new QueryByCriteria(example);
  -        try
  -        {
  -            // 3. start broker transaction
  -            broker.beginTransaction();
  +        // 4. lookup the product specified by the QBE
  +        Product toBeEdited = (Product) broker.getObjectByQuery(query);
   
  -            // 4. lookup the product specified by the QBE
  -            Product toBeEdited = (Product) broker.getObjectByQuery(query);
  -
  -            // 5. edit the existing entry
  -            System.out.println("please edit the product entry");
  -            in = readLineWithMessage("enter name (was " + toBeEdited.getName() + "):");
  -            toBeEdited.setName(in);
  -            in = readLineWithMessage("enter price (was " + toBeEdited.getPrice() + "):");
  -            toBeEdited.setPrice(Double.parseDouble(in));
  -            in = readLineWithMessage("enter available stock (was " + toBeEdited.getStock()+ "):");
  -            toBeEdited.setStock(Integer.parseInt(in));
  -
  -            // 6. now ask broker to store the edited object
  -            broker.store(toBeEdited);
  -            // 7. commit transaction
  -            broker.commitTransaction();
  -        }
  -        catch (Throwable t)
  -        {
  -            // rollback in case of errors
  -            broker.abortTransaction();
  -            t.printStackTrace();
  -        }
  +        // 5. edit the existing entry
  +        System.out.println("please edit the product entry");
  +        in = readLineWithMessage(
  +                "enter name (was " + toBeEdited.getName() + "):");
  +        toBeEdited.setName(in);
  +        in = readLineWithMessage(
  +                "enter price (was " + toBeEdited.getPrice() + "):");
  +        toBeEdited.setPrice(Double.parseDouble(in));
  +        in = readLineWithMessage(
  +                "enter available stock (was " +
  +                    toBeEdited.getStock()+ "):");
  +        toBeEdited.setStock(Integer.parseInt(in));
  +
  +        // 6. now ask broker to store the edited object
  +        broker.store(toBeEdited);
  +        // 7. commit transaction
  +        broker.commitTransaction();
  +    }
  +    catch (Throwable t)
  +    {
  +        // rollback in case of errors
  +        broker.abortTransaction();
  +        t.printStackTrace();
       }
  +}
     ]]></source>
   
   </subsection>
  @@ -494,37 +501,37 @@
     </p>
   
     <source><![CDATA[
  -    public void apply()
  +public void apply()
  +{
  +    String in = readLineWithMessage("Delete Product with id:");
  +    int id = Integer.parseInt(in);
  +
  +    // We do not have a reference to the selected Product.
  +    // So first we have to lookup the object,
  +    // we do this by a query by example (QBE):
  +    // 1. build an example object with matching primary key values:
  +    Product example = new Product();
  +    example.setId(id);
  +    // 2. build a QueryByCriteria from this sample instance:
  +    Query query = new QueryByCriteria(example);
  +    try
       {
  -        String in = readLineWithMessage("Delete Product with id:");
  -        int id = Integer.parseInt(in);
  -
  -        // We do not have a reference to the selected Product.
  -        // So first we have to lookup the object,
  -        // we do this by a query by example (QBE):
  -        // 1. build an example object with matching primary key values:
  -        Product example = new Product();
  -        example.setId(id);
  -        // 2. build a QueryByCriteria from this sample instance:
  -        Query query = new QueryByCriteria(example);
  -        try
  -        {
  -            // start broker transaction
  -            broker.beginTransaction();
  -            // lookup the product specified by the QBE
  -            Product toBeDeleted = (Product) broker.getObjectByQuery(query);
  -            // now ask broker to delete the object
  -            broker.delete(toBeDeleted);
  -            // commit transaction
  -            broker.commitTransaction();
  -        }
  -        catch (Throwable t)
  -        {
  -            // rollback in case of errors
  -            broker.abortTransaction();
  -            t.printStackTrace();
  -        }
  +        // start broker transaction
  +        broker.beginTransaction();
  +        // lookup the product specified by the QBE
  +        Product toBeDeleted = (Product) broker.getObjectByQuery(query);
  +        // now ask broker to delete the object
  +        broker.delete(toBeDeleted);
  +        // commit transaction
  +        broker.commitTransaction();
  +    }
  +    catch (Throwable t)
  +    {
  +        // rollback in case of errors
  +        broker.abortTransaction();
  +        t.printStackTrace();
       }
  +}
     ]]></source>
   
     <p>
  @@ -545,11 +552,11 @@
     ]]></source>
   
     <p>
  -  	An arbitrary number of criteria can be added to produce very complex 
  +  	An arbitrary number of criteria can be added to produce very complex
     	queries.  The following code demonstrates a more complex use of the Criteria
  -  	object, one that is not present in this tutorial application.  This code 
  +  	object, one that is not present in this tutorial application.  This code
     	retrieves all products which are priced less than 5.40 (USD, Yen, Euros, etc.)
  -  	and  of which we have at least 2 million in stock: 
  +  	and  of which we have at least 2 million in stock:
     </p>
   
     <source><![CDATA[
  @@ -624,7 +631,7 @@
     <p>
       But it has also at least one disadvantage: Performance. Due to the
       dynamic approach OJB uses either Java Reflection or JavaBeans compliant
  -    access to inspect and modify business objects. 
  +    access to inspect and modify business objects.
       We took great care to reduce the dynamic access overhead to a minimum.
     </p>
     <p>
  @@ -698,7 +705,10 @@
     <source><![CDATA[
       public class Product
       {
  -        /** this is the primary key attribute needed by OJB to identify instances*/
  +        /**
  +         * this is the primary key attribute needed by OJB to
  +         * identify instances
  +         */
           private int _id;
   
           /** product name*/
  @@ -718,7 +728,7 @@
     </p>
     <p>
       <b>There is one important exception:</b> persistent capable classes <B>must</B>
  -    provide a public no-argument constructor. 
  +    provide a public no-argument constructor.
       <!--Implementing a constructor that
       initializes all persistent attributes is recommended for performance
       reasons but not required. OJB will print out warnings when such a
  @@ -757,8 +767,10 @@
   ]>
   
   
  -<descriptor-repository version="0.9.1" isolation-level="read-uncommitted">
  -<!-- The Default JDBC Connection. If a class-descriptor does not specify its own JDBC Connection,
  +<descriptor-repository version="0.9.1"
  +        isolation-level="read-uncommitted">
  +<!-- The Default JDBC Connection. If a class-descriptor does not
  +     specify its own JDBC Connection,
        the Connection specified here will be used. -->
   
      <jdbc-connection-descriptor
  @@ -799,7 +811,7 @@
       The mapping contains a default
       <code>JDBCConnectionDescriptor</code>. Such a
       Descriptor contains information about the JDBC connection used for
  -    persistence operations.  
  +    persistence operations.
       The JDBC
       connection defined by this default descriptor is used for all classes that do
       not have a specific <code>JDBCConnectionDescriptor</code>.
  @@ -809,31 +821,31 @@
       database is located in the samples directory.
     </li>
     <li>
  -    Mappings for OJB regression tests. This is done 
  +    Mappings for OJB regression tests. This is done
       by including the file <code>repository_junit.xml</code> by means of the XML entity
       <code>&amp;junit;</code>. This entity is defined as a file include:
   	<source><![CDATA[
   	<!ENTITY junit SYSTEM "repository_junit.xml">
   	]]></source>
  -    
  +
     </li>
     <li>
       The OJB internal mappings. OJB needs some
       internal tables, e.g for maintaining locks, auto counters and the
       ODMG collections and Maps. The corresponding mappings are contained
       here. They are essential for the proper operation of the system and
  -    must not be modified. More information on the internal tables can be 
  +    must not be modified. More information on the internal tables can be
       <a href="platforms.html">found here</a>.
       <br/>
  -    These internal mappings are defined  
  +    These internal mappings are defined
       by including the file <code>repository_internal.xml</code> by means of the XML entity
       <code>&amp;internal;</code>.
     </li>
     <li>
  -  	The user defined mappings. User defined mappings contain all object/relational 
  +  	The user defined mappings. User defined mappings contain all object/relational
     	mapping information on your persistent classes.
     	By default the mappings for the tutorial applications are stored here.
  -  	These mappings are defined by including the file 
  +  	These mappings are defined by including the file
     	<code>repository_user.xml</code> by means of the XML entity
       <code>&amp;user;</code>.
       <br/>
  @@ -888,9 +900,11 @@
   For each persistent attribute of this
   class we need a field-descriptor, that defines the column where this
   attribute has to be stored. For primary key attributes we have a
  -special marker attribute <code>primarykey="true"</code>. The primary key field is also tagged as
  -<code>autoincrement="true"</code>, this will tell OJB to assign unique Ids to this
  -attribute. Internally this is done by a SequenceManager utility class.
  +special marker attribute <code>primarykey="true"</code>.
  +The primary key field is also tagged as
  +<code>autoincrement="true"</code>, this will tell OJB to assign
  +unique Ids to this attribute. Internally this is done by a
  +SequenceManager utility class.
   </p>
   <p>
   field-descriptor are sufficient for
  @@ -909,7 +923,7 @@
   advanced mapping topic.</A>
   </p>
   <p>
  -	A complete documentation of the repository syntax and semantics can be 
  +	A complete documentation of the repository syntax and semantics can be
   	<a href="repository.html">found here</a>.
   </p>
   </subsection>
  @@ -924,17 +938,17 @@
       <br/>
       We have started to work on a tool that generates a database from an
       existing repository.xml file.
  -    Call <b><code>build[.sh] forward-db</code></b> to see our reverse 
  +    Call <b><code>build[.sh] forward-db</code></b> to see our reverse
       engineering tool at work.
       <br/>
  -    After building your db you can inspect it by calling 
  +    After building your db you can inspect it by calling
       <b><code>build[.sh] browse-db</code></b>.
     </li>
     <li>
       <b>Reverse engineering</b>, SQL DDL or a life
       Database are given, Java classes and mapping have to be generated.
       <br/>
  -    Call <b><code>build[.sh] reverse-db</code></b> to see our reverse 
  +    Call <b><code>build[.sh] reverse-db</code></b> to see our reverse
       engineering tool at work.
     </li>
     <li>
  
  
  
  1.14      +364 -355  jakarta-ojb/xdocs/tutorial3.xml
  
  Index: tutorial3.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/xdocs/tutorial3.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- tutorial3.xml	26 Jul 2002 06:17:21 -0000	1.13
  +++ tutorial3.xml	21 Dec 2002 16:17:34 -0000	1.14
  @@ -104,26 +104,26 @@
       This is the DDL of the underlying tables:
     </p>
     <source><![CDATA[
  -  CREATE TABLE Artikel
  -  (
  -      Artikel_Nr         INT NOT NULL PRIMARY KEY,
  -      Artikelname        VARCHAR(60),
  -      Lieferanten_Nr     INT,
  -      Kategorie_Nr       INT,
  -      Liefereinheit      VARCHAR(30),
  -      Einzelpreis        FLOAT,
  -      Lagerbestand       INT,
  -      BestellteEinheiten INT,
  -      MindestBestand     INT,
  -      Auslaufartikel     INT
  -  )
  -
  -  CREATE TABLE Kategorien
  -  (
  -      Kategorie_Nr       INT NOT NULL PRIMARY KEY,
  -      KategorieName      VARCHAR(20),
  -      Beschreibung       VARCHAR(60)
  -  )
  +CREATE TABLE Artikel
  +(
  +  Artikel_Nr         INT NOT NULL PRIMARY KEY,
  +  Artikelname        VARCHAR(60),
  +  Lieferanten_Nr     INT,
  +  Kategorie_Nr       INT,
  +  Liefereinheit      VARCHAR(30),
  +  Einzelpreis        FLOAT,
  +  Lagerbestand       INT,
  +  BestellteEinheiten INT,
  +  MindestBestand     INT,
  +  Auslaufartikel     INT
  +)
  +
  +CREATE TABLE Kategorien
  +(
  +  Kategorie_Nr       INT NOT NULL PRIMARY KEY,
  +  KategorieName      VARCHAR(20),
  +  Beschreibung       VARCHAR(60)
  +)
     ]]></source>
     <p>
       To declare the foreign key mechanics of this reference attribute we
  @@ -144,7 +144,7 @@
           These elements define foreign key attributes.
           The element <code><foreignkey field-id-ref="4"/></code>
           contains the id of the field-descriptor describing the
  -        foreignkey fields. 
  +        foreignkey fields.
           The FieldDescriptor with the id 4 describes the foreignkey attribute
           productGroupId:
           <source><![CDATA[
  @@ -226,25 +226,23 @@
       </LI>
     </OL>
     <source><![CDATA[
  -
  -      <field-descriptor id="17"
  -         name="sampleArticleId"
  -         column="SAMPLE_ARTICLE_ID"
  -         jdbc-type="INTEGER"
  -      />
  +<field-descriptor id="17"
  +    name="sampleArticleId"
  +    column="SAMPLE_ARTICLE_ID"
  +    jdbc-type="INTEGER"
  +/>
     ]]></source>
     <OL>
             <LI>Add a ReferenceDescriptor to the ClassDescriptor of the Class
             ProductGroup:</LI>
     </OL>
     <source><![CDATA[
  -
  -      <reference-descriptor
  -         name="sampleArticle"
  -         class-ref="org.apache.ojb.broker.Article"
  -      >
  -         <foreignkey field-id-ref="17"/>
  -      </reference-descriptor>
  +<reference-descriptor
  +    name="sampleArticle"
  +    class-ref="org.apache.ojb.broker.Article"
  +>
  +    <foreignkey field-id-ref="17"/>
  +</reference-descriptor>
     ]]></source>
   
   </section>
  @@ -372,54 +370,59 @@
             materialization, updating and deletion.</LI>
     </OL>
     <source><![CDATA[
  -  public class ArticleCollection implements ManageableCollection, java.io.Serializable
  -  {
  -      private Vector elements;
  -
  -      public ArticleCollection()
  -      {
  -          super();
  -          elements = new Vector();
  -      }
  -
  -      public void add(InterfaceArticle article)
  -      {
  -          elements.add(article);
  -      }
  -
  -      public InterfaceArticle get(int index)
  -      {
  -          return (InterfaceArticle) elements.get(index);
  -      }
  -
  -      /**
  -       * add a single Object to the Collection. This method is used during reading
  -       * Collection elements from the database. Thus it is is save to cast anObject
  -       * to the underlying element type of the collection.
  -       */
  -      public void ojbAdd(java.lang.Object anObject)
  -      {
  -          elements.add((InterfaceArticle) anObject);
  -      }
  -
  -      /**
  -       * adds a Collection to this collection. Used in reading Extents from the Database.
  -       * Thus it is save to cast otherCollection to this.getClass().
  -       */
  -      public void ojbAddAll(ojb.broker.ManageableCollection otherCollection)
  -      {
  -          elements.addAll(((ArticleCollection) otherCollection).elements);
  -      }
  -
  -      /**
  -       * returns an Iterator over all elements in the collection.
  -       * Used during store and delete Operations.
  -       */
  -      public java.util.Iterator ojbIterator()
  -      {
  -          return elements.iterator();
  -      }
  -  }
  +public class ArticleCollection implements ManageableCollection,
  +                                        java.io.Serializable
  +{
  +    private Vector elements;
  +
  +    public ArticleCollection()
  +    {
  +      super();
  +      elements = new Vector();
  +    }
  +
  +    public void add(InterfaceArticle article)
  +    {
  +      elements.add(article);
  +    }
  +
  +    public InterfaceArticle get(int index)
  +    {
  +      return (InterfaceArticle) elements.get(index);
  +    }
  +
  +    /**
  +    * add a single Object to the Collection. This method is
  +    * used during reading Collection elements from the
  +    * database. Thus it is is save to cast anObject
  +    * to the underlying element type of the collection.
  +    */
  +    public void ojbAdd(java.lang.Object anObject)
  +    {
  +      elements.add((InterfaceArticle) anObject);
  +    }
  +
  +    /**
  +    * adds a Collection to this collection. Used in reading
  +    * Extents from the Database.
  +    * Thus it is save to cast otherCollection to this.getClass().
  +    */
  +    public void ojbAddAll(
  +            ojb.broker.ManageableCollection otherCollection)
  +    {
  +      elements.addAll(
  +            ((ArticleCollection) otherCollection).elements);
  +    }
  +
  +    /**
  +    * returns an Iterator over all elements in the collection.
  +    * Used during store and delete Operations.
  +    */
  +    public java.util.Iterator ojbIterator()
  +    {
  +      return elements.iterator();
  +    }
  +}
     ]]></source>
   </subsection>
   </section>
  @@ -612,11 +615,11 @@
   <p>
   If there is no need for an association class on the
   OOD level (say we are not interested in role information), OJB can be
  -configured to do the m:n mapping transparently. 
  +configured to do the m:n mapping transparently.
   For example a Person does not
   have a collection of Role Objects but only a Collection of
   <code>Project</code> objects (hold in an
  -attribute <code>projects</code>). 
  +attribute <code>projects</code>).
   Projects
   also are expected to contain a collection of <code>Persons</code>
   (hold in attribute <code>persons</code>).
  @@ -723,8 +726,8 @@
         On materializing an Object from the RDBMS with
         <code>PersistenceBroker.getObjectByQuery(...)</code>all
         it's referenced objects (both 1:1 and 1:n associations) are
  -      materialized as well. 
  -      (If OJB is configured to use proxies, the referenced objects are 
  +      materialized as well.
  +      (If OJB is configured to use proxies, the referenced objects are
         not materialized immmediately, but lazy loading proxy objects are used
         instead.)
       </LI>
  @@ -748,8 +751,8 @@
   </p>
   <p>
   	In the following code sample, a reference-descriptor and a collection-descriptor
  -	are configured to use cascading retrieve (<code>auto-retrieve="true"</code>), 
  -	insert and update (<code>auto-update="true"</code>) and delete 
  +	are configured to use cascading retrieve (<code>auto-retrieve="true"</code>),
  +	insert and update (<code>auto-update="true"</code>) and delete
   	(<code>auto-delete="true"</code>) operations:
   </p>
   
  @@ -844,9 +847,11 @@
   
   </p>
   <source><![CDATA[
  -public class ArticleProxy extends VirtualProxy implements InterfaceArticle
  +public class ArticleProxy extends VirtualProxy
  +                            implements InterfaceArticle
   {
  -    public ArticleProxy(ojb.broker.Identity uniqueId, PersistenceBroker broker)
  +    public ArticleProxy(ojb.broker.Identity uniqueId,
  +                            PersistenceBroker broker)
       {
           super(uniqueId, broker);
       }
  @@ -882,10 +887,10 @@
   uses getRealSubject() from the base class VirtualProxy:
   </p>
   <source><![CDATA[
  -    public Object getRealSubject() throws PersistenceBrokerException
  -    {
  -        return indirectionHandler.getRealSubject();
  -    }
  +public Object getRealSubject() throws PersistenceBrokerException
  +{
  +    return indirectionHandler.getRealSubject();
  +}
   ]]></source>
   <p>
   The proxy delegates the the materialization work to its
  @@ -895,19 +900,21 @@
   used to retrieve it by its OID:
   </p>
   <source><![CDATA[
  -    public synchronized Object getRealSubject() throws PersistenceBrokerException
  +public synchronized Object getRealSubject()
  +                    throws PersistenceBrokerException
  +{
  +    if (realSubject == null)
       {
  -        if (realSubject == null)
  -        {
  -            materializeSubject();
  -        }
  -        return realSubject;
  +        materializeSubject();
       }
  +    return realSubject;
  +}
   
  -    private void materializeSubject() throws PersistenceBrokerException
  -    {
  -        realSubject = broker.getObjectByIdentity(id);
  -    }
  +private void materializeSubject()
  +                    throws PersistenceBrokerException
  +{
  +    realSubject = broker.getObjectByIdentity(id);
  +}
   ]]></source>
   
   <p>
  @@ -916,12 +923,12 @@
   repository file:
   </p>
   <source><![CDATA[
  -   <class-descriptor
  -      class="org.apache.ojb.broker.Article"
  -      proxy="org.apache.ojb.broker.ArticleProxy"
  -      table="Artikel"
  -   >
  -   ...
  +<class-descriptor
  +    class="org.apache.ojb.broker.Article"
  +    proxy="org.apache.ojb.broker.ArticleProxy"
  +    table="Artikel"
  +>
  +...
   ]]></source>
   <p>
   The following class diagram shows the relationships between all above
  @@ -949,12 +956,12 @@
   we have to declare it in the repository.xml file.
   </p>
   <source><![CDATA[
  -   <class-descriptor
  -      class="org.apache.ojb.broker.Article"
  -      proxy="dynamic"
  -      table="Artikel"
  -   >
  -   ...
  +<class-descriptor
  +  class="org.apache.ojb.broker.Article"
  +  proxy="dynamic"
  +  table="Artikel"
  +>
  +...
   ]]></source>
   
   <p>
  @@ -977,26 +984,27 @@
   </p>
   
   <source><![CDATA[
  -<!-- Definitions for org.apache.ojb.broker.ProductGroupWithCollectionProxy -->
  -   <class-descriptor
  -      class="org.apache.ojb.broker.ProductGroupWithCollectionProxy"
  -      table="Kategorien"
  -   >
  -      <field-descriptor id="1"
  -         name="groupId"
  -         column="Kategorie_Nr"
  -         jdbc-type="INTEGER"
  -         primarykey="true"
  -      />
  -      ...
  -      <collection-descriptor
  -         name="allArticlesInGroup"
  -         element-class-ref="org.apache.ojb.broker.Article"
  -         proxy="true"
  -      >
  -         <inverse-foreignkey field-id-ref="4"/>
  -      </collection-descriptor>
  -   </class-descriptor>
  +<!-- Definitions for
  +org.apache.ojb.broker.ProductGroupWithCollectionProxy -->
  +<class-descriptor
  +  class="org.apache.ojb.broker.ProductGroupWithCollectionProxy"
  +  table="Kategorien"
  +>
  +  <field-descriptor id="1"
  +     name="groupId"
  +     column="Kategorie_Nr"
  +     jdbc-type="INTEGER"
  +     primarykey="true"
  +  />
  +  ...
  +  <collection-descriptor
  +     name="allArticlesInGroup"
  +     element-class-ref="org.apache.ojb.broker.Article"
  +     proxy="true"
  +  >
  +     <inverse-foreignkey field-id-ref="4"/>
  +  </collection-descriptor>
  +</class-descriptor>
   ]]></source>
   
   <p>
  @@ -1055,7 +1063,7 @@
   <p>
   	Say your database column contains INTEGER values but you have to
   	use boolean attributes in your Domain objects. You need a type- and
  -	value mapping described by a FieldConversion! 
  +	value mapping described by a FieldConversion!
   	<A HREF="jdbc-types.html">Follow this link to learn more</A>.
   </p>
   </section>
  @@ -1088,33 +1096,25 @@
   </code><it>object</it>.
   </p>
   <source><![CDATA[
  -    public void testCollectionByQuery()
  -    {
  -        try
  -        {
  -            Criteria crit = new Criteria();
  -            crit.addEqualTo("articleName", "Hamlet");
  -            Query q = QueryFactory.newQuery(InterfaceArticle.class, crit);
  -
  -            Collection result = broker.getCollectionByQuery(q);
  +public void testCollectionByQuery() throws Exception
  +{
  +    Criteria crit = new Criteria();
  +    crit.addEqualTo("articleName", "Hamlet");
  +    Query q = QueryFactory.newQuery(InterfaceArticle.class, crit);
   
  -            System.out.println(result);
  +    Collection result = broker.getCollectionByQuery(q);
   
  -            assertNotNull("should return at least one item", result);
  -            assertTrue("should return at least one item", result.size() > 0);
  +    System.out.println(result);
   
  -        }
  -        catch (Throwable t)
  -        {
  -            fail(t.getMessage());
  -        }
  -    }
  +    assertNotNull("should return at least one item", result);
  +    assertTrue("should return at least one item", result.size() > 0);
  +}
   ]]></source>
   
   <p>
   Of course it is also possible to define reference attributes of an
   interface or baseclass type. In all above examples Article has a
  -reference attribute of type InterfaceProductGroup. 
  +reference attribute of type InterfaceProductGroup.
   </p>
   </subsection>
   
  @@ -1128,27 +1128,18 @@
   InterfaceArticle objects:
   </p>
   <source><![CDATA[
  -    public void testExtentByQuery()
  -    {
  -        try
  -        {
  -            // no criteria signals to omit a WHERE clause
  -            Query q = QueryFactory.newQuery(InterfaceArticle.class, null);
  -
  -            Collection result = broker.getCollectionByQuery(q);
  -
  -
  -            System.out.println("OJB proudly presents: The InterfaceArticle Extent\n" + result);
  +public void testExtentByQuery() throws Exception
  +{
  +    // no criteria signals to omit a WHERE clause
  +    Query q = QueryFactory.newQuery(InterfaceArticle.class, null);
  +    Collection result = broker.getCollectionByQuery(q);
   
  -            assertNotNull("should return at least one item", result);
  -            assertTrue("should return at least one item", result.size() > 0);
  +    System.out.println(
  +        "OJB proudly presents: The InterfaceArticle Extent\n" +result);
   
  -        }
  -        catch (Throwable t)
  -        {
  -            fail(t.getMessage());
  -        }
  -    }
  +    assertNotNull("should return at least one item", result);
  +    assertTrue("should return at least one item", result.size() > 0);
  +}
   ]]></source>
   <p>
   The set of all instances of a class (whether living in memory or
  @@ -1373,7 +1364,7 @@
   ]]></source>
   <p>
   	The column CLASS_NAME is used to store the concrete type of each
  -	object. 
  +	object.
   </p>
   <p>
   	If you can't provide such an additional column, but have to
  @@ -1387,49 +1378,51 @@
   	mechanism. The code of the default implementation looks like follows:
   </p>
   <source><![CDATA[
  -    protected ClassDescriptor selectClassDescriptor(
  -        Map row,
  -        ClassDescriptor cld)
  -        throws PersistenceBrokerException
  +protected ClassDescriptor selectClassDescriptor(
  +    Map row,
  +    ClassDescriptor cld)
  +    throws PersistenceBrokerException
  +{
  +    // check if there is an attribute which
  +    // tells us which concrete class
  +    // is to be instantiated
  +    FieldDescriptor concreteClassFD =
  +                    cld.getFieldDescriptorByName(
  +                        ClassDescriptor.OJB_CONCRETE_CLASS);
  +
  +    if (concreteClassFD == null)
  +        return cld;
  +    else
       {
  -        // check if there is an attribute which tells us which concrete class 
  -        // is to be instantiated
  -        FieldDescriptor concreteClassFD =
  -            cld.getFieldDescriptorByName(ClassDescriptor.OJB_CONCRETE_CLASS);
  -
  -        if (concreteClassFD == null)
  -            return cld;
  -        else
  +        PersistenceBroker broker = null;
  +        try
           {
  -            PersistenceBroker broker = null;
  -            try
  -            {
  -                String concreteClass =
  -                    (String) row.get(concreteClassFD.getColumnName());
  -                broker = PersistenceBrokerFactory.createPersistenceBroker();
  -                ClassDescriptor result =
  -                    broker.getClassDescriptor(
  -                        Class.forName(
  -                            concreteClass,
  -                            true,
  -                            Thread.currentThread().getContextClassLoader()));
  -                PersistenceBrokerFactory.releaseInstance(broker);
  -                if (result == null)
  -                    result = cld;
  -                return result;
  -            }
  -            catch (PersistenceBrokerException e)
  -            {
  -                PersistenceBrokerFactory.releaseInstance(broker);
  -                throw e;
  -            }
  -            catch (ClassNotFoundException e)
  -            {
  -                PersistenceBrokerFactory.releaseInstance(broker);
  -                throw new PersistenceBrokerException(e);
  -            }
  +            String concreteClass =
  +                (String) row.get(concreteClassFD.getColumnName());
  +            broker =PersistenceBrokerFactory.createPersistenceBroker();
  +            ClassDescriptor result =
  +                broker.getClassDescriptor(
  +                  Class.forName(
  +                      concreteClass,
  +                      true,
  +                      Thread.currentThread().getContextClassLoader()));
  +            PersistenceBrokerFactory.releaseInstance(broker);
  +            if (result == null)
  +                result = cld;
  +            return result;
  +        }
  +        catch (PersistenceBrokerException e)
  +        {
  +            PersistenceBrokerFactory.releaseInstance(broker);
  +            throw e;
  +        }
  +        catch (ClassNotFoundException e)
  +        {
  +            PersistenceBrokerFactory.releaseInstance(broker);
  +            throw new PersistenceBrokerException(e);
           }
       }
  +}
   ]]></source>
   <p>
   After implementing this Class you must edit the ClassDescriptor of
  @@ -1440,7 +1433,7 @@
   <code>row-reader="my.own.RowReaderImpl"</code>
   </p>
   <p>
  -You will learn more about RowReaders in the 
  +You will learn more about RowReaders in the
   <a href="#using rowreaders">next section.</a>
   </p>
   </subsection>
  @@ -1483,115 +1476,123 @@
   <code>getObjectFromResultSet()</code>:
   </p>
   <source><![CDATA[
  -	protected Object getObjectFromResultSet() throws PersistenceBrokerException
  -	{
  -		if (itemProxyClass != null)
  -		{
  -			// provide m_row with primary key data of current row
  -			m_mif.getRowReader().readPkValuesFrom(m_rsAndStmt.m_rs, m_mif, m_row);
  -			// assert: m_row is filled with primary key values from db
  -			return getProxyFromResultSet();
  -		}
  -		else
  -		{
  -			// 0. provide m_row with data of current row
  -			m_mif.getRowReader().readObjectArrayFrom(m_rsAndStmt.m_rs, m_mif, m_row);
  -			// assert: m_row is filled from db
  -
  -			// 1.read Identity
  -			Identity oid = getIdentityFromResultSet();
  -			Object result = null;
  -
  -			// 2. check if Object is in cache. if so return cached version.
  -			result = cache.lookup(oid);
  -			if (result == null)
  -			{
  -				// 3. If Object is not in cache
  -				// materialize Object with primitive attributes filled from current row
  -				result = m_mif.getRowReader().readObjectFrom(m_row, m_mif);
  -				// result may still be null!
  -				if (result != null)
  -				{
  -					cache.cache(oid, result);
  -					// fill reference and collection attributes
  -					ClassDescriptor cld = m_mif.getRepository().getDescriptorFor(result.getClass());
  -					m_broker.retrieveReferences(result, cld);
  -					m_broker.retrieveCollections(result, cld);
  -				}
  -			}
  -			else
  -			{
  -				ClassDescriptor cld = m_mif.getRepository().getDescriptorFor(result.getClass());
  -				m_broker.refreshRelationships(result, cld);
  -			}
  -
  -			return result;
  -		}
  -	}
  +protected Object getObjectFromResultSet() throws PersistenceBrokerException
  +{
  +    if (itemProxyClass != null)
  +    {
  +        // provide m_row with primary key data of current row
  +        m_mif.getRowReader().
  +            readPkValuesFrom(m_rsAndStmt.m_rs, m_mif, m_row);
  +        // assert: m_row is filled with primary key values from db
  +        return getProxyFromResultSet();
  +    }
  +    else
  +    {
  +        // 0. provide m_row with data of current row
  +        m_mif.getRowReader().
  +            readObjectArrayFrom(m_rsAndStmt.m_rs, m_mif, m_row);
  +        // assert: m_row is filled from db
  +
  +        // 1.read Identity
  +        Identity oid = getIdentityFromResultSet();
  +        Object result = null;
  +
  +        // 2. check if Object is in cache. if so return cached version.
  +        result = cache.lookup(oid);
  +        if (result == null)
  +        {
  +            // 3. If Object is not in cache
  +            // materialize Object with primitive
  +            // attributes filled from current row
  +            result = m_mif.getRowReader().readObjectFrom(m_row, m_mif);
  +            // result may still be null!
  +            if (result != null)
  +            {
  +                cache.cache(oid, result);
  +                // fill reference and collection attributes
  +                ClassDescriptor cld = m_mif.getRepository().
  +                                getDescriptorFor(result.getClass());
  +                m_broker.retrieveReferences(result, cld);
  +                m_broker.retrieveCollections(result, cld);
  +            }
  +        }
  +        else
  +        {
  +            ClassDescriptor cld = m_mif.getRepository().
  +                                getDescriptorFor(result.getClass());
  +            m_broker.refreshRelationships(result, cld);
  +        }
  +
  +        return result;
  +    }
  +}
   ]]></source>
   <p>
  -	This method first uses a RowReader to instantiate a new object array 
  +	This method first uses a RowReader to instantiate a new object array
   	and to fill it with primitive attributes from the
  -	current ResultSet row. 
  -	
  +	current ResultSet row.
  +
   	<br/>
   	The RowReader to be used for a Class can be configured in the XML
   	repository with the attribute <code>row-reader</code>.
   	If no RowReader is specified, the RowReaderDefaultImpl is used. The
   	method <code>readObjectArrayFrom(...)</code> of this class looks like follows:
  -	
  -</p>	
  +
  +</p>
   <source><![CDATA[
  -    public void readObjectArrayFrom(ResultSet rs, ClassDescriptor cld, Map row)
  +public void readObjectArrayFrom(ResultSet rs,
  +                                ClassDescriptor cld,
  +                                Map row)
  +{
  +    try
       {
  -    	try
  -    	{
  -            Collection fields = cld.getRepository().
  -            				getFieldDescriptorsForMultiMappedTable(cld);
  -            Iterator it = fields.iterator();
  -            while (it.hasNext())
  -            {
  -                FieldDescriptor fmd = (FieldDescriptor) it.next();
  -                FieldConversion conversion = fmd.getFieldConversion();
  -                Object val = JdbcAccess.getObjectFromColumn(rs, fmd);
  -                row.put(fmd.getColumnName() , conversion.sqlToJava(val));
  -            }
  -    	}
  -    	catch (SQLException t)
  -    	{
  -            throw new PersistenceBrokerException("Error reading from result set",t);
  -    	}
  -    	
  +        Collection fields = cld.getRepository().
  +                        getFieldDescriptorsForMultiMappedTable(cld);
  +        Iterator it = fields.iterator();
  +        while (it.hasNext())
  +        {
  +            FieldDescriptor fmd = (FieldDescriptor) it.next();
  +            FieldConversion conversion = fmd.getFieldConversion();
  +            Object val = JdbcAccess.getObjectFromColumn(rs, fmd);
  +            row.put(fmd.getColumnName() , conversion.sqlToJava(val));
  +        }
       }
  +    catch (SQLException t)
  +    {
  +        throw new PersistenceBrokerException(
  +            "Error reading from result set",t);
  +    }
  +
  +}
   ]]></source>
   
   
   
  -	
  -<p>	
  +
  +<p>
   	In the second step OJB checks if there is
  -	already a cached version of the object to materialize. 
  +	already a cached version of the object to materialize.
   	If so the cached instance is
  -	returned. If not, the object is fully materialized by 
  -	first reading in primary attributes with the RowReader 
  +	returned. If not, the object is fully materialized by
  +	first reading in primary attributes with the RowReader
   	method <code>readObjectFrom(Map row, ClassDescriptor descriptor)</code>
       and in a second step by retrieving
   	reference- and collection-attributes.
  -	The fully materilized Object is then returned.	
  +	The fully materilized Object is then returned.
   </p>
   
  -<source><![CDATA[	
  -    public Object readObjectFrom(Map row, ClassDescriptor descriptor) 
  -    					throws PersistenceBrokerException
  -    {
  -        // allow to select a specific classdescriptor
  -        ClassDescriptor cld = selectClassDescriptor(row, descriptor);
  -        return buildWithReflection(cld, row);
  -    }
  -]]></source>	
  +<source><![CDATA[
  +public Object readObjectFrom(Map row, ClassDescriptor descriptor)
  +                    throws PersistenceBrokerException
  +{
  +    // allow to select a specific classdescriptor
  +    ClassDescriptor cld = selectClassDescriptor(row, descriptor);
  +    return buildWithReflection(cld, row);
  +}
  +]]></source>
   
   <p>
  -	By implementing your own RowReader you can hook into the OJB 
  +	By implementing your own RowReader you can hook into the OJB
   	materialization process and	provide additional features.
   </p>
   
  @@ -1603,7 +1604,7 @@
   	object's table.
   </p>
   <p>
  -	The class <code>org.apache.ojb.broker.ArticleWithStockDetail</code> 
  +	The class <code>org.apache.ojb.broker.ArticleWithStockDetail</code>
   	has a <code>stockDetail</code>
   	attribute, holding a reference to a <code>StockDetail</code>
   	object. The class StockDetail is not declared in the XML repository.
  @@ -1617,36 +1618,37 @@
   	follows:
   </p>
   <source><![CDATA[
  -    public Object readObjectFrom(Map row, ClassDescriptor cld)
  +public Object readObjectFrom(Map row, ClassDescriptor cld)
  +{
  +    Object result = super.readObjectFrom(row, cld);
  +    if (result instanceof ArticleWithStockDetail)
       {
  -        Object result = super.readObjectFrom(row, cld);
  -        if (result instanceof ArticleWithStockDetail)
  -        {
  -            ArticleWithStockDetail art = (ArticleWithStockDetail) result;
  -            boolean sellout = art.isSelloutArticle;
  -            int minimum = art.minimumStock;
  -            int ordered = art.orderedUnits;
  -            int stock = art.stock;
  -            String unit = art.unit;
  -            StockDetail detail = new StockDetail(sellout, minimum, ordered, stock, unit, art);
  -            art.stockDetail = detail;
  -            return art;
  -        }
  -        else
  -        {
  -            return result;
  -        }
  +        ArticleWithStockDetail art = (ArticleWithStockDetail) result;
  +        boolean sellout = art.isSelloutArticle;
  +        int minimum = art.minimumStock;
  +        int ordered = art.orderedUnits;
  +        int stock = art.stock;
  +        String unit = art.unit;
  +        StockDetail detail = new StockDetail(sellout, minimum,
  +                                    ordered, stock, unit, art);
  +        art.stockDetail = detail;
  +        return art;
       }
  +    else
  +    {
  +        return result;
  +    }
  +}
   ]]></source>
   <p>
   To activate this RowReader the ClassDescriptor for the class
   ArticleWithStockDetail contains the following entry:</p>
   <source><![CDATA[
  -   <class-descriptor
  -      class="org.apache.ojb.broker.ArticleWithStockDetail"
  -      table="Artikel"
  -      row-reader="org.apache.ojb.broker.RowReaderTestImpl"
  -   >
  +<class-descriptor
  +  class="org.apache.ojb.broker.ArticleWithStockDetail"
  +  table="Artikel"
  +  row-reader="org.apache.ojb.broker.RowReaderTestImpl"
  +>
   ]]></source>
   </subsection>
   
  @@ -1669,41 +1671,41 @@
   public interface PersistenceBrokerAware
   {
    	/**
  - 	 * this method is called as the first operation within a call to 
  + 	 * this method is called as the first operation within a call to
    	 * PersistenceBroker.store(PersistenceBrokerAware instance).
  - 	 */   
  + 	 */
       public void beforeStore() throws PersistenceBrokerException;
   
    	/**
  - 	 * this method is called as the last operation within a call to 
  + 	 * this method is called as the last operation within a call to
    	 * PersistenceBroker.store(PersistenceBrokerAware instance).
  - 	 */       
  + 	 */
       public void afterStore() throws PersistenceBrokerException;
  - 
  +
     	/**
  - 	 * this method is called as the first operation within a call to 
  + 	 * this method is called as the first operation within a call to
    	 * PersistenceBroker.delete(PersistenceBrokerAware instance).
  - 	 */   
  + 	 */
       public void beforeDelete() throws PersistenceBrokerException;
  -       
  +
    	/**
  - 	 * this method is called as the last operation within a call to 
  + 	 * this method is called as the last operation within a call to
    	 * PersistenceBroker.delete(PersistenceBrokerAware instance).
  - 	 */   
  + 	 */
       public void afterDelete() throws PersistenceBrokerException;
  - 
  +
    	/**
  - 	 * this method is called as the last operation within a call to 
  - 	 * PersistenceBroker.getObjectByXXX() or 
  + 	 * this method is called as the last operation within a call to
  + 	 * PersistenceBroker.getObjectByXXX() or
    	 * PersistenceBroker.getCollectionByXXX().
  - 	 */       
  + 	 */
       public void afterLookup() throws PersistenceBrokerException;
   }
   ]]></source>
  -	
  -<p>	
  +
  +<p>
   	If you want your persistent entity to perform certain operations
  -	after it has been stored by the PersistenceBroker you have to perform 
  +	after it has been stored by the PersistenceBroker you have to perform
   	the following steps:
   	<ol>
   		<li>
  @@ -1715,7 +1717,7 @@
   		</li>
   		<li>
   			implement the method <code>afterStore()</code> to perform
  -			your intended logic.			
  +			your intended logic.
   		</li>
   	</ol>
   </p>
  @@ -1728,10 +1730,11 @@
   	value to the primary key column mapped to the attribute <code>m_id</code>.
   	The <code>.afterStore()</code> instance callback is used to update
   	the the attribute <code>m_id</code> with this value.
  -</p>		
  -	
  +</p>
  +
   <source><![CDATA[
  -public abstract class DBAutoIncremented implements PersistenceBrokerAware
  +public abstract class DBAutoIncremented
  +                    implements PersistenceBrokerAware
   {
       private static final String ID_ATTRIBUTE_NAME = "m_id";
   
  @@ -1744,7 +1747,8 @@
       }
   
       /**
  -     * after storing a new instance reflect the autoincremented PK value
  +     * after storing a new instance reflect the
  +     * autoincremented PK value
        * back into the PK attribute.
        */
       public void afterStore()
  @@ -1754,7 +1758,7 @@
   
           try
           {
  -            // remove object from cache to ensure we are retrieving a 
  +            // remove object from cache to ensure we are retrieving a
               // copy that is in sync with the database.
               broker.removeFromCache(this;)
   
  @@ -1768,7 +1772,8 @@
               if (hasNotBeenSet(idField))
               {
   
  -                // retrieve the object again with a query on all non-id attributes.
  +                // retrieve the object again with a query
  +                // on all non-id attributes.
                   Object object =
                       broker.getObjectByQuery(
                           buildQueryOnAllNonIdAttributes(clazz, cld));
  @@ -1784,7 +1789,8 @@
                               + " because lookup by attributes failed");
                   }
   
  -                // set id attribute with the value assigned by the database.
  +                // set id attribute with the value
  +                // assigned by the database.
                   idField.set(this, idField.get(object));
               }
           }
  @@ -1819,7 +1825,8 @@
   
           for (int i = 0; i < fields.length; i++)
           {
  -            if (!fields[i].getAttributeName().equals(ID_ATTRIBUTE_NAME))
  +            if (!fields[i].getAttributeName().
  +                            equals(ID_ATTRIBUTE_NAME))
               {
                   if (values[i] == null)
                   {
  @@ -1827,7 +1834,8 @@
                   }
                   else
                   {
  -                    crit.addEqualTo(fields[i].getAttributeName(), values[i]);
  +                    crit.addEqualTo(fields[i].getAttributeName(),
  +                                                        values[i]);
                   }
               }
           }
  @@ -1842,9 +1850,10 @@
       {
           return (((Integer) idField.get(this)).intValue() == 0);
       }
  -]]></source>	
  -	
  -	
  +}
  +]]></source>
  +
  +
   </section>
   
   </body>
  
  
  
  1.6       +22 -14    jakarta-ojb/xdocs/jdbc-types.xml
  
  Index: jdbc-types.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/xdocs/jdbc-types.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- jdbc-types.xml	28 Jul 2002 23:25:31 -0000	1.5
  +++ jdbc-types.xml	21 Dec 2002 16:17:34 -0000	1.6
  @@ -196,24 +196,32 @@
   <source><![CDATA[
   /**
    *
  - * FieldConversion declares a protocol for type and value 
  + * FieldConversion declares a protocol for type and value
    * conversions between persistent classes attributes and the columns
  - * of the RDBMS. 
  + * of the RDBMS.
    * The default implementation does not modify its input.
  - * OJB users can use predefined implementation and can also 
  + * OJB users can use predefined implementation and can also
    * build their own conversions that perform arbitrary mappings.
  - * the mapping has to defined in the xml repository in the field-descriptor.
  + * the mapping has to defined in the xml repository
  + * in the field-descriptor.
    *
    * @author Thomas Mahler
    *
    */
   public interface FieldConversion extends Serializable
   {
  -    /** convert a Java object to its SQL pendant, used for insert & update*/
  -    public abstract Object javaToSql(Object source) throws ConversionException;
  +    /**
  +     * convert a Java object to its SQL
  +     * pendant, used for insert & update
  +     */
  +    public abstract Object javaToSql(Object source)
  +                                throws ConversionException;
   
  -    /** convert a SQL value to a Java Object, used for SELECT*/
  -    public abstract Object sqlToJava(Object source) throws ConversionException;
  +    /**
  +     * convert a SQL value to a Java Object, used for SELECT
  +     */
  +    public abstract Object sqlToJava(Object source)
  +                            throws ConversionException;
   
   }
   ]]></source>
  @@ -287,9 +295,9 @@
   ]]></source>
   
   <p>
  -	There are other helpful standard conversions defined in the package 
  +	There are other helpful standard conversions defined in the package
   	<code>org.apache.ojb.broker.accesslayer.conversions</code>:
  -	Of course it is possible to map between <code>java.sql.date</code> and 
  +	Of course it is possible to map between <code>java.sql.date</code> and
   	<code>java.util.date</code> by using a Conversion.
   	A very interesting Conversion is the <code>Object2ByteArrFieldConversion</code>
   	it allows to store inlined objects in varchar columns!
  @@ -315,18 +323,18 @@
         <extent-class class-ref="org.apache.ojb.broker.CdArticle" />
   
         ...
  -      
  +
         <field-descriptor id="10"
            name="isSelloutArticle"
            column="Auslaufartikel"
            jdbc-type="INTEGER"
  -         conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
  +         conversion="org.apache.ojb.broker.accesslayer.
  +                        conversions.Boolean2IntFieldConversion"
         />
  -      
  +
         ...
   
      </class-descriptor>
  -
   ]]></source>
   </subsection>
   </section>
  
  
  
  1.10      +68 -49    jakarta-ojb/xdocs/query.xml
  
  Index: query.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/xdocs/query.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- query.xml	20 Oct 2002 11:28:27 -0000	1.9
  +++ query.xml	21 Dec 2002 16:17:34 -0000	1.10
  @@ -11,7 +11,8 @@
   <section name="OJB Queries">
   
   <p>
  -This tutorial describes the use of the different queries mechanisms. The sample code shown here is taken mainly from JUnit test classes.
  +This tutorial describes the use of the different queries mechanisms.
  +The sample code shown here is taken mainly from JUnit test classes.
   </p>
   
   <subsection name="table of contents">
  @@ -25,20 +26,25 @@
   
   <subsection name="query by criteria">
   <p>
  -In this section you will learn how to use the query by criteria. The classes are located in the package
  +In this section you will learn how to use the query by criteria.
  +The classes are located in the package
   <FONT FACE="Courier, monospace">org.apache.ojb.broker.query</FONT>.
  -Using query by criteria you can either <A HREF="#querying for objects">query for whole objects</A> (ie. person) or you can use <A HREF="#report queries">report queries</A> returning row data.
  +Using query by criteria you can either <A HREF="#querying for objects">query for whole objects</A>
  +(ie. person) or you can use <A HREF="#report queries">report queries</A> returning row data.
   <br/><br/>
   A query consists mainly of the following parts:
   <ol>
   <li>the class of the objects to be retrieved</li>
   <li>a list of criteria with ORDER BY and GROUP BY</li>
   </ol>
  -
  -OJB offers a QueryFactory to create a new Query. Although the constructors of the query classes are public using the QueryFactory is the preferred way to create a new query.
  +</p>
  +<p>
  +OJB offers a QueryFactory to create a new Query. Although the
  +constructors of the query classes are public using the QueryFactory
  +is the preferred way to create a new query.
   
   <source><![CDATA[
  -  Query q = QueryFactory.newQuery(Person.class, crit);
  +Query q = QueryFactory.newQuery(Person.class, crit);
   ]]></source>
   
   </p>
  @@ -47,18 +53,18 @@
   <br/>
   
   <source><![CDATA[
  -  Criteria crit = new Criteria();
  +Criteria crit = new Criteria();
   
  -  crit.addEqualTo("firstname", "tom");
  -  crit.addEqualTo("lastname", "hanks");
  -  Query q = QueryFactory.newQuery(Person.class, crit);
  +crit.addEqualTo("firstname", "tom");
  +crit.addEqualTo("lastname", "hanks");
  +Query q = QueryFactory.newQuery(Person.class, crit);
   ]]></source>
   
   <br/>
   This query will generate an SQL statement like this:
   
   <source><![CDATA[
  -  SELECT ... FROM PERSON WHERE FIRSTNAME = "tom" AND LASTNAME = "hanks";
  +SELECT ... FROM PERSON WHERE FIRSTNAME = "tom" AND LASTNAME = "hanks";
   ]]></source>
   <br/>
   
  @@ -104,15 +110,16 @@
   the limit is set to 3 for the following sample:
   
   <source><![CDATA[
  -SELECT ... FROM Artikel A0 WHERE A0.Kategorie_Nr IN ( ? , ? , ? ) OR A0.Kategorie_Nr IN ( ? , ? ) ORDER BY 7 DESC
  +SELECT ... FROM Artikel A0 WHERE A0.Kategorie_Nr IN ( ? , ? , ? ) OR
  +A0.Kategorie_Nr IN ( ? , ? ) ORDER BY 7 DESC
   ]]></source>
   <br/>
   
   The IN-limit for prefetch can be defined in OJB.properties:
   <source><![CDATA[
   ...
  -# The SqlInLimit entry limits the number of values in IN-sql statement,
  -# -1 for no limits. This hint is used in Criteria.
  +# The SqlInLimit entry limits the number of values in IN-sql
  +# statement, -1 for no limits. This hint is used in Criteria.
   SqlInLimit=200
   ...
   ]]></source>
  @@ -127,23 +134,24 @@
   These sets are combined using addOrCriteria:
   
   <source><![CDATA[
  -  Criteria crit1 = new Criteria();
  -  crit1.addLike("firstname", "%o%");
  -  crit1.addLike("lastname", "%m%");
  -  Criteria crit2 = new Criteria();
  -  crit2.addEqualTo("firstname", "hank");
  +Criteria crit1 = new Criteria();
  +crit1.addLike("firstname", "%o%");
  +crit1.addLike("lastname", "%m%");
  +Criteria crit2 = new Criteria();
  +crit2.addEqualTo("firstname", "hank");
   
  -  crit1.addOrCriteria(crit2);
  -  Query q = QueryFactory.newQuery(Person.class, crit1);
  +crit1.addOrCriteria(crit2);
  +Query q = QueryFactory.newQuery(Person.class, crit1);
   
  -  Collection results = broker.getCollectionByQuery(q);
  +Collection results = broker.getCollectionByQuery(q);
   ]]></source>
   
   <br/>
   This query will generate an SQL statement like this:
   
   <source><![CDATA[
  -  SELECT ... WHERE (FIRSTNAME LIKE "%o%") AND LASTNAME LIKE "%m%" OR FIRSTNAME = "hank"
  +SELECT ... WHERE (FIRSTNAME LIKE "%o%") AND LASTNAME
  +LIKE "%m%" OR FIRSTNAME = "hank"
   ]]></source>
   
   </p>
  @@ -159,21 +167,24 @@
   <li>addOrderByDescending(String anAttributeName);</li>
   <li>addGroupBy(String anAttributeName); this method is used for <A HREF="#report queries">report queries</A></li>
   </ul>
  -You can of course have multiple order by and group by clauses, simply repeat the addOrderBy.
  +You can of course have multiple order by and group by clauses,
  +simply repeat the addOrderBy.
   
   <source><![CDATA[
  -  crit = new Criteria();
  -  crit.addOrderByDescending("id");
  -  crit.addOrderByAscending("lastname");
  -  query = new QueryByCriteria(Person.class, crit);
  -  broker.getCollectionByQuery(query);
  +crit = new Criteria();
  +crit.addOrderByDescending("id");
  +crit.addOrderByAscending("lastname");
  +query = new QueryByCriteria(Person.class, crit);
  +broker.getCollectionByQuery(query);
   ]]></source>
   
  -The code snippet will query all Persons and order them by <b>attribute</b> "id" descending and "lastname" ascending.
  -The query will produce the following SQL-statement using column numbers in the ORDER BY clause:
  +The code snippet will query all Persons and order them by <b>attribute</b> "id"
  +descending and "lastname" ascending.
  +The query will produce the following SQL-statement using column numbers
  +in the ORDER BY clause:
   
   <source><![CDATA[
  -  SELECT A0.ID,A0.FIRSTNAME,A0.LASTNAME FROM PERSON A0 ORDER BY 1 DESC,3
  +SELECT A0.ID,A0.FIRSTNAME,A0.LASTNAME FROM PERSON A0 ORDER BY 1 DESC,3
   ]]></source>
   
   <br/>
  @@ -182,7 +193,8 @@
   added.
   
   <source><![CDATA[
  -  SELECT A0.ID,A0.FIRSTNAME,A0.LASTNAME,LASTNAME FROM PERSON A0 ORDER BY 1 DESC,4
  +SELECT A0.ID,A0.FIRSTNAME,A0.LASTNAME,LASTNAME FROM
  +PERSON A0 ORDER BY 1 DESC,4
   ]]></source>
   
   If there are multiple tables with a column "LASTNAME" the SQL-Statement will produce an error,
  @@ -234,11 +246,11 @@
   The path expression includes the 1:1 relationship "productGroup" and the attribute "groupName":
   
   <source><![CDATA[
  -  Criteria crit = new Criteria();
  -  crit.addEqualTo("productGroup.groupName", "Liquors");
  -  Query q = QueryFactory.newQuery(Article.class, crit);
  +Criteria crit = new Criteria();
  +crit.addEqualTo("productGroup.groupName", "Liquors");
  +Query q = QueryFactory.newQuery(Article.class, crit);
   
  -  Collection results = broker.getCollectionByQuery(q);
  +Collection results = broker.getCollectionByQuery(q);
   ]]></source>
   
   </p>
  @@ -254,13 +266,13 @@
   With prefetched relationships OJB tries to read all Articles belonging to the ProductGroups in <b>one</b> query.
   See further down why one query is not always possible.
   <source><![CDATA[
  -  Criteria crit = new Criteria();
  -  crit.addLessOrEqualThan("groupId", new Integer(5));
  -  crit.addOrderByDescending("groupId");
  -  crit.addPrefetchedRelationship("allArticlesInGroup");
  +Criteria crit = new Criteria();
  +crit.addLessOrEqualThan("groupId", new Integer(5));
  +crit.addOrderByDescending("groupId");
  +crit.addPrefetchedRelationship("allArticlesInGroup");
   
  -  Query q = QueryFactory.newQuery(ProductGroup.class, crit);
  -  Collection results = broker.getCollectionByQuery(q);
  +Query q = QueryFactory.newQuery(ProductGroup.class, crit);
  +Collection results = broker.getCollectionByQuery(q);
   ]]></source>
   
   <br/>
  @@ -271,7 +283,8 @@
   
   The second query retrieves Articles belonging to the ProductGroups read by the first query:
   <source><![CDATA[
  -SELECT ... FROM Artikel A0 WHERE A0.Kategorie_Nr IN ( ? , ? , ? , ? , ? ) ORDER BY 7 DESC
  +SELECT ... FROM Artikel A0 WHERE A0.Kategorie_Nr
  +IN ( ? , ? , ? , ? , ? ) ORDER BY 7 DESC
   ]]></source>
   
   <br/>
  @@ -286,8 +299,10 @@
   the limit is set to 3 for the following sample:
   
   <source><![CDATA[
  -SELECT ... FROM Artikel A0 WHERE A0.Kategorie_Nr IN ( ? , ? , ? ) ORDER BY 7 DESC
  -SELECT ... FROM Artikel A0 WHERE A0.Kategorie_Nr IN ( ? , ? ) ORDER BY 7 DESC
  +SELECT ... FROM Artikel A0 WHERE A0.Kategorie_Nr
  +IN ( ? , ? , ? ) ORDER BY 7 DESC
  +SELECT ... FROM Artikel A0 WHERE A0.Kategorie_Nr
  +IN ( ? , ? ) ORDER BY 7 DESC
   ]]></source>
   <br/>
   
  @@ -315,14 +330,18 @@
   Criteria crit = new Criteria();
   Collection results = new Vector();
   
  -ReportQueryByCriteria q = QueryFactory.newReportQuery(ProductGroup.class, crit);
  +ReportQueryByCriteria q = QueryFactory.newReportQuery(
  +                            ProductGroup.class, crit);
   // define the 'columns' of the report
  -q.setColumns(new String[] { "groupName", "sum(allArticlesInGroup.stock)", "sum(allArticlesInGroup.price)" });
  +q.setColumns(new String[] { "groupName",
  +                            "sum(allArticlesInGroup.stock)",
  +                            "sum(allArticlesInGroup.price)" });
   crit.addGroupBy("groupName");
   
   Iterator iter = broker.getReportQueryIteratorByQuery(q);
   ]]></source>
  -The ReportQuery returns an Iterator over a Collection of Object[3] ([String, Integer, Double]).
  +The ReportQuery returns an Iterator over a Collection of
  +Object[3] ([String, Integer, Double]).
   
   </subsection>
   
  
  
  
  1.7       +146 -136  jakarta-ojb/xdocs/tutorial2.xml
  
  Index: tutorial2.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/xdocs/tutorial2.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- tutorial2.xml	8 Dec 2002 12:01:03 -0000	1.6
  +++ tutorial2.xml	21 Dec 2002 16:17:34 -0000	1.7
  @@ -1,9 +1,9 @@
  -<?xml version="1.0"?>
  +<?xml version="1.0" encoding="ISO-8859-1"?>
   <document>
   
     <properties>
       <author email="thma@apache.org">Thomas Mahler</author>
  -    <author email="tobrien@transolutions.net">Tim O'Brien</author>    
  +    <author email="tobrien@transolutions.net">Tim O'Brien</author>
       <title>ObJectRelationalBridge Tutorial - Part 2</title>
     </properties>
   
  @@ -35,8 +35,8 @@
   	important aspects like ODMG persistent collections. For a complete
   	reference see the book <B><I>&quot;The Object Data Standard: ODMG
   	3.0&quot;</I>, ed. R.G.G. Cattell, D.K. Barry, Morgan Kaufmann
  -	Publishers [ODMG30]. </B>You will also find helpful material at the<B>
  -	</B><A HREF="http://www.odmg.org/"><B>ODMG site</B></A>.
  +	Publishers [ODMG30]. </B>You will also find helpful material at the
  +    <A HREF="http://www.odmg.org/"><B>ODMG site</B></A>.
   </p>
   </subsection>
   
  @@ -185,38 +185,40 @@
   each product matching our query.
   </p>
   <source><![CDATA[
  -    public void apply()
  +public void apply()
  +{
  +    System.out.println("The list of available products:");
  +    try
       {
  -        System.out.println("The list of available products:");
  -        try
  -        {
  -            // 1. open a transaction
  -            Transaction tx = odmg.newTransaction();
  -            tx.begin();
  -
  -            // 2. get an OQLQuery object from the ODMG facade
  -            OQLQuery query = odmg.newOQLQuery();
  -
  -            // 3. set the OQL select statement
  -            query.create("select allproducts from " + Product.class.getName());
  -
  -            // 4. perform the query and store the result in a persistent Collection
  -            DList allProducts = (DList) query.execute();
  -            tx.commit();
  -
  -            // 5. now iterate over the result to print each product
  -            java.util.Iterator iter = allProducts.iterator();
  -            while (iter.hasNext())
  -            {
  -                System.out.println(iter.next());
  -            }
  -
  -        }
  -        catch (Throwable t)
  +        // 1. open a transaction
  +        Transaction tx = odmg.newTransaction();
  +        tx.begin();
  +
  +        // 2. get an OQLQuery object from the ODMG facade
  +        OQLQuery query = odmg.newOQLQuery();
  +
  +        // 3. set the OQL select statement
  +        query.create("select allproducts from " +
  +                                Product.class.getName());
  +
  +        // 4. perform the query and store the result
  +        // in a persistent Collection
  +        DList allProducts = (DList) query.execute();
  +        tx.commit();
  +
  +        // 5. now iterate over the result to print each product
  +        java.util.Iterator iter = allProducts.iterator();
  +        while (iter.hasNext())
           {
  -            t.printStackTrace();
  +            System.out.println(iter.next());
           }
  +
  +    }
  +    catch (Throwable t)
  +    {
  +        t.printStackTrace();
       }
  +}
   ]]></source>
   
   </subsection>
  @@ -256,36 +258,37 @@
   PersistenceBroker instance.)
   </p>
   <source><![CDATA[
  -    public void apply()
  -    {
  -        // 1. this will be our new object
  -        Product newProduct = new Product();
  -        // 2. now read in all relevant information and fill the new object:
  -        System.out.println("please enter a new product");
  -        String in = readLineWithMessage("enter name:");
  -        newProduct.setName(in);
  -        in = readLineWithMessage("enter price:");
  -        newProduct.setPrice(Double.parseDouble(in));
  -        in = readLineWithMessage("enter available stock:");
  -        newProduct.setStock(Integer.parseInt(in));
  -
  -        // now perform persistence operations
  -        Transaction tx = null;
  -
  -        try {
  -            // 3. open transaction
  -            tx = odmg.newTransaction();
  -            tx.begin();
  -            
  -            // 4. acquire write lock on new object
  -            tx.lock(newProduct, Transaction.WRITE);
  -
  -            // 5. commit transaction
  -            tx.commit();
  -        } catch( LockNotGrantedException lnge ) {
  -        	// Code omitted for tutorial brevity....
  -        }    
  +public void apply()
  +{
  +    // 1. this will be our new object
  +    Product newProduct = new Product();
  +    // 2. now read in all relevant information and
  +    // fill the new object:
  +    System.out.println("please enter a new product");
  +    String in = readLineWithMessage("enter name:");
  +    newProduct.setName(in);
  +    in = readLineWithMessage("enter price:");
  +    newProduct.setPrice(Double.parseDouble(in));
  +    in = readLineWithMessage("enter available stock:");
  +    newProduct.setStock(Integer.parseInt(in));
  +
  +    // now perform persistence operations
  +    Transaction tx = null;
  +
  +    try {
  +        // 3. open transaction
  +        tx = odmg.newTransaction();
  +        tx.begin();
  +
  +        // 4. acquire write lock on new object
  +        tx.lock(newProduct, Transaction.WRITE);
  +
  +        // 5. commit transaction
  +        tx.commit();
  +    } catch( LockNotGrantedException lnge ) {
  +        // Code omitted for tutorial brevity....
       }
  +}
   ]]></source>
   
   </subsection>
  @@ -302,53 +305,58 @@
   on the database.
   </p>
   <source><![CDATA[
  -    public void apply()
  -    {
  -        String in = readLineWithMessage("Edit Product with id:");
  -        int id = Integer.parseInt(in);
  +public void apply()
  +{
  +    String in = readLineWithMessage("Edit Product with id:");
  +    int id = Integer.parseInt(in);
   
  -        // We don't have a reference to the selected Product.
  -        // So first we have to lookup the object.
  +    // We don't have a reference to the selected Product.
  +    // So first we have to lookup the object.
   
  -        // 1. build oql query to select product by id:
  -        String oqlQuery = "select del from " + Product.class.getName() + " where _id = " + id;
  +    // 1. build oql query to select product by id:
  +    String oqlQuery = "select del from " +
  +                        Product.class.getName() +
  +                        " where _id = " + id;
   
  -        Database db = odmg.getDatabase(null); // the current DB
  -        Transaction tx = null;
  -        try
  -        {
  -            // 2. start transaction
  -            tx = odmg.newTransaction();
  -            tx.begin();
  -
  -            // 3. lookup the product specified by query
  -            OQLQuery query = odmg.newOQLQuery();
  -            query.create(oqlQuery);
  -            DList result = (DList) query.execute();
  -            Product toBeEdited = (Product) result.get(0);
  -
  -            // 4. lock the product for write access
  -            tx.lock(toBeEdited, Transaction.WRITE);
  -
  -            // 5. Edit the product entry
  -            System.out.println("please edit existing product");
  -            in = readLineWithMessage("enter name (was " + toBeEdited.getName() + "):");
  -            toBeEdited.setName(in);
  -            in = readLineWithMessage("enter price (was " + toBeEdited.getPrice() + "):");
  -            toBeEdited.setPrice(Double.parseDouble(in));
  -            in = readLineWithMessage("enter available stock (was " + toBeEdited.getStock() + "):");
  -            toBeEdited.setStock(Integer.parseInt(in));
  +    Database db = odmg.getDatabase(null); // the current DB
  +    Transaction tx = null;
  +    try
  +    {
  +        // 2. start transaction
  +        tx = odmg.newTransaction();
  +        tx.begin();
  +
  +        // 3. lookup the product specified by query
  +        OQLQuery query = odmg.newOQLQuery();
  +        query.create(oqlQuery);
  +        DList result = (DList) query.execute();
  +        Product toBeEdited = (Product) result.get(0);
  +
  +        // 4. lock the product for write access
  +        tx.lock(toBeEdited, Transaction.WRITE);
  +
  +        // 5. Edit the product entry
  +        System.out.println("please edit existing product");
  +        in = readLineWithMessage(
  +            "enter name (was " + toBeEdited.getName() + "):");
  +        toBeEdited.setName(in);
  +        in = readLineWithMessage(
  +            "enter price (was " + toBeEdited.getPrice() + "):");
  +        toBeEdited.setPrice(Double.parseDouble(in));
  +        in = readLineWithMessage(
  +            "enter available stock (was "+toBeEdited.getStock() + "):");
  +        toBeEdited.setStock(Integer.parseInt(in));
   
  -            // 6. commit transaction
  -            tx.commit();
  -        }
  -        catch (Throwable t)
  -        {
  -            // rollback in case of errors
  -            tx.abort();
  -            t.printStackTrace();
  -        }
  +        // 6. commit transaction
  +        tx.commit();
  +    }
  +    catch (Throwable t)
  +    {
  +        // rollback in case of errors
  +        tx.abort();
  +        t.printStackTrace();
       }
  +}
   ]]></source>
   
   </subsection>
  @@ -384,43 +392,45 @@
   PersistenceBroker (i.e. perform a &quot;DELETE FROM ...&quot;).
   </p>
   <source><![CDATA[
  -    public void apply()
  -    {
  -        String in = readLineWithMessage("Delete Product with id:");
  -        int id = Integer.parseInt(in);
  +public void apply()
  +{
  +    String in = readLineWithMessage("Delete Product with id:");
  +    int id = Integer.parseInt(in);
   
  -        // We don't have a reference to the selected Product.
  -        // So first we have to lookup the object.
  +    // We don't have a reference to the selected Product.
  +    // So first we have to lookup the object.
   
  -        // 1. build oql query to select product by id:
  -        String oqlQuery = "select del from " + Product.class.getName() + " where _id = " + id;
  +    // 1. build oql query to select product by id:
  +    String oqlQuery = "select del from " +
  +                        Product.class.getName() +
  +                        " where _id = " + id;
   
  -        Database db = odmg.getDatabase(null); // the current DB
  -        Transaction tx = null;
  -        try
  -        {
  -            // 2. start transaction
  -            tx = odmg.newTransaction();
  -            tx.begin();
  -
  -            // 3. lookup the product specified by query
  -            OQLQuery query = odmg.newOQLQuery();
  -            query.create(oqlQuery);
  -            DList result = (DList) query.execute();
  -            Product toBeDeleted = (Product) result.get(0);
  -
  -            // 4. now mark object for deletion
  -            db.deletePersistent(toBeDeleted);
  -            // 5. commit transaction
  -            tx.commit();
  -        }
  -        catch (Throwable t)
  -        {
  -            // rollback in case of errors
  -            tx.abort();
  -            t.printStackTrace();
  -        }
  +    Database db = odmg.getDatabase(null); // the current DB
  +    Transaction tx = null;
  +    try
  +    {
  +        // 2. start transaction
  +        tx = odmg.newTransaction();
  +        tx.begin();
  +
  +        // 3. lookup the product specified by query
  +        OQLQuery query = odmg.newOQLQuery();
  +        query.create(oqlQuery);
  +        DList result = (DList) query.execute();
  +        Product toBeDeleted = (Product) result.get(0);
  +
  +        // 4. now mark object for deletion
  +        db.deletePersistent(toBeDeleted);
  +        // 5. commit transaction
  +        tx.commit();
  +    }
  +    catch (Throwable t)
  +    {
  +        // rollback in case of errors
  +        tx.abort();
  +        t.printStackTrace();
       }
  +}
   ]]></source>
   
   </subsection>
  
  
  
  1.5       +12 -8     jakarta-ojb/xdocs/stylesheets/site.xsl
  
  Index: site.xsl
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/xdocs/stylesheets/site.xsl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- site.xsl	8 Dec 2002 12:01:04 -0000	1.4
  +++ site.xsl	21 Dec 2002 16:17:34 -0000	1.5
  @@ -31,7 +31,7 @@
     <!-- Defined variables (non-overrideable) -->
     <xsl:variable name="body-bg"       select="'#ffffff'"/>
     <xsl:variable name="body-fg"       select="'#000000'"/>
  -  <xsl:variable name="body-link"     select="'#525D76'"/>
  +  <xsl:variable name="body-link"     select="'#003366'"/>
     <xsl:variable name="banner-bg"     select="'#525D76'"/>
     <xsl:variable name="banner-fg"     select="'#ffffff'"/>
     <xsl:variable name="sub-banner-bg" select="'#828DA6'"/>
  @@ -41,7 +41,8 @@
     <xsl:variable name="source-color"  select="'#023264'"/>
     <xsl:variable name="header-color"  select="'#003366'"/>
   
  - 
  +
  +
     <!-- Process an entire document into an HTML page -->
     <xsl:template match="document">
       <xsl:variable name="project"
  @@ -106,12 +107,15 @@
         <tr>
   
           <xsl:comment>LEFT SIDE NAVIGATION</xsl:comment>
  -        <td width="20%" valign="top" nowrap="true">
  +        <td width="15%" valign="top" nowrap="false">
  +<!-- We use a smaller font for the menu -->
  +            <font size="-1">
             <xsl:apply-templates select="$project/body/menu"/>
  +            </font>
           </td>
   
           <xsl:comment>RIGHT SIDE MAIN BODY</xsl:comment>
  -        <td width="80%" valign="top" align="left">
  +        <td width="85%" valign="top" align="left">
             <xsl:apply-templates select="body/section"/>
           </td>
   
  @@ -159,7 +163,7 @@
               </xsl:when>
               <xsl:otherwise>
                   <xsl:value-of select="$relative-path"/><xsl:value-of select="@href"/>
  -            </xsl:otherwise>    
  +            </xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
       <li><a href="{$href}"><xsl:value-of select="@name"/></a></li>
  @@ -181,7 +185,7 @@
   	    </xsl:otherwise>
   	  </xsl:choose>
   	</xsl:variable>
  -	  
  +
       <table border="0" cellspacing="0" cellpadding="2" width="100%">
         <!-- Section heading -->
         <tr><td bgcolor="{$banner-bg}">
  @@ -278,7 +282,7 @@
           </font>
       </td>
     </xsl:template>
  -  
  +
     <!-- handle th ala site.vsl -->
     <xsl:template match="th">
       <td bgcolor="{$table-th-bg}" valign="top">
  @@ -289,7 +293,7 @@
           </font>
       </td>
     </xsl:template>
  -  
  +
     <!-- Process everything else by just passing it through -->
     <xsl:template match="*|@*">
       <xsl:copy>
  
  
  

Mime
View raw message