Modified: db/jdo/site/docs/svn.html URL: http://svn.apache.org/viewvc/db/jdo/site/docs/svn.html?rev=581796&r1=581795&r2=581796&view=diff ============================================================================== --- db/jdo/site/docs/svn.html (original) +++ db/jdo/site/docs/svn.html Thu Oct 4 01:11:54 2007 @@ -1,7 +1,7 @@ Java Data Objects (JDO) - Source Code

Source Code Version Control

Apache JDO uses Subversion to manage its source code. + @import url("./style/maven-theme.css");

Source Code Version Control

Apache JDO uses Subversion to manage its source code. If you're new to Subversion, you can check out the online book about Subversion. Note that we are currently using Subversion 1.1.x (there are separate @@ -54,5 +54,5 @@

  • Copy the servers file and the auth folder from the sygwin ~/.subversion directory to C:\Documents and Settings\<user>\Application Data\Subversion used by Win32 subversion.

  • Note that windows svn uses backslash as the path separator when displaying file names. You cannot just copy and paste this file name to another svn command when running from within a cygwin shell. You need to enclose the file name into double quotes.

    Alternatively, Windows users can set file permissions in Windows Explorer. (Right-click on the top-level folder & select Properties. Select the Security tab. Click Advanced. Remove all instances of Read & Execute from the Permission Entries. Click "Reset permissions on all child objects and enable propogations of inheritable permissions". Click Apply. OK. OK.) You will have to do this again when you do a clean checkout to a new directory.


    Modified: db/jdo/site/docs/tck.html URL: http://svn.apache.org/viewvc/db/jdo/site/docs/tck.html?rev=581796&r1=581795&r2=581796&view=diff ============================================================================== --- db/jdo/site/docs/tck.html (original) +++ db/jdo/site/docs/tck.html Thu Oct 4 01:11:54 2007 @@ -1,7 +1,7 @@ Java Data Objects (JDO) - TCK

    About the Technology Compatibility Kit

    + @import url("./style/maven-theme.css");

    About the Technology Compatibility Kit

    In order to demonstrate compliance with the Java Data Objects specification, an implementation must pass all of the tests in the Technology Compatibility Kit (TCK). @@ -25,5 +25,5 @@ test run, which consists of multiple log files containing configuration information and test results. For an example of the required posting, please see http://db.apache.org/jdo/tck/final.


    Modified: db/jdo/site/docs/team-list.html URL: http://svn.apache.org/viewvc/db/jdo/site/docs/team-list.html?rev=581796&r1=581795&r2=581796&view=diff ============================================================================== --- db/jdo/site/docs/team-list.html (original) +++ db/jdo/site/docs/team-list.html Thu Oct 4 01:11:54 2007 @@ -1,7 +1,7 @@ Java Data Objects (JDO) - Project Team

    The Apache JDO Team

    + @import url("./style/maven-theme.css");

    The Apache JDO Team

    The people listed below have made significant contributions to JDO by working long and hard to make quality software for the rest of the world to use. @@ -15,5 +15,5 @@ If you would like to become a committer, please see Get Involved.

    Apache JDO Committers

    NameOrganization
    Matthew AdamsInterface21
    Erik BengtsonJPOX
    Michael BouschenTech@Spree
    Michelle CaisseSun Microsystems, Inc.
    Andy JeffersonJPOX
    Patrick LinskeySolarmetric
    Geir Magnusson Jr.IBM
    Brian McCallister
    Craig RussellSun Microsystems, Inc.
    Dain Sundstrom
    Brian Topping
    Michael WatzekTech@Spree
    Martin ZaunSun Microsystems, Inc.

    Apache JDO Contributors

    NameOrganization
    Chris Beams
    Ilan KirschObjectDB

    Modified: db/jdo/site/docs/why_jdo.html URL: http://svn.apache.org/viewvc/db/jdo/site/docs/why_jdo.html?rev=581796&r1=581795&r2=581796&view=diff ============================================================================== --- db/jdo/site/docs/why_jdo.html (original) +++ db/jdo/site/docs/why_jdo.html Thu Oct 4 01:11:54 2007 @@ -1,7 +1,7 @@ Java Data Objects (JDO) - Why JDO ?

    Why JDO ?

    + @import url("./style/maven-theme.css");

    Why JDO ?

    The majority of applications need to persist (or store) data during their lifecycle. There are many ways of doing this with an application written in Java.

    @@ -32,5 +32,5 @@

  • some advanced EJB containers like Bea Weblogic and IBM Websphere provide support for primary key generation, inherited objects and database schema creation as well.

  • Modified: db/jdo/site/xdocs/navigation.xml URL: http://svn.apache.org/viewvc/db/jdo/site/xdocs/navigation.xml?rev=581796&r1=581795&r2=581796&view=diff ============================================================================== --- db/jdo/site/xdocs/navigation.xml (original) +++ db/jdo/site/xdocs/navigation.xml Thu Oct 4 01:11:54 2007 @@ -21,22 +21,23 @@ - - - - - + + + + + + Added: db/jdo/site/xdocs/pm.xml URL: http://svn.apache.org/viewvc/db/jdo/site/xdocs/pm.xml?rev=581796&view=auto ============================================================================== --- db/jdo/site/xdocs/pm.xml (added) +++ db/jdo/site/xdocs/pm.xml Thu Oct 4 01:11:54 2007 @@ -0,0 +1,212 @@ + + + + Persistence Manager + + + +
    +

    + Any JDO-enabled application will require at least one PersistenceManager (PM). + This is obtained from the PersistenceManagerFactory for the datastore. +

    +

    + The simplest way of creating a PersistenceManager + + is as follows +

    + +PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(props); +PersistenceManager pm = pmf.getPersistenceManager(); +

    + A PersistenceManager is the key to all persistence operations in JDO. With it you can + persist, update, delete, and retrieve objects from the datastore. A PersistenceManager + has a single transaction. +

    +
    + + +

    + To persist an object, the object must first be marked as persistable using + MetaData (XML/Annotations). Then you would start the + PM transaction, and use makePersistent as follows +

    + +PersistenceManager pm = pmf.getPersistenceManager(); +Transaction tx = pm.currentTransaction(); +try +{ + // Start the transaction + tx.begin(); + + // Create the object to persist + MyClass obj = new MyClass(); + + // Persist it to the datastore + pm.makePersistent(obj); + + // Commit the transaction, flushing the object to the datastore + tx.commit(); +} +catch (Exception e) +{ + ... handle exceptions +} +finally +{ + if (tx.isActive()) + { + // Error occurred so rollback the transaction + tx.rollback(); + } + pm.close(); +} +

    + The makePersistent method of PersistenceManager makes the object persistent in + the datastore, and updates the 'state' of the object from Transient (at the start) + to Hollow (after commit() of the transaction). +

    +

    + When an object is persisted, if it has any other objects referenced from that object they + also will be made persistent. This is referred to as persistence-by-reachability. + The main benefit of this is that if you have an object graph to persist, then you don't + need to call makePersistent() on all objects, instead just using one that can be + used to find all of the others. persistence-by-reachability is also run at the time of + calling commit() on the transaction. This has the effect that if you had called + makePersistent() on an object and that had persisted another object, and before + commit you had removed the relation to this other object, then at commit() the + reachability algorithm will find that this other object is no longer reachable and will + remove it from persistence. +

    +
    +
    + + +

    + So we've made some of our objects persistent, and now we want to retrieve them in + our application. Here's one way of retrieving objects of a particular type. +

    + +tx = pm.currentTransaction(); +try +{ + tx.begin(); + + Extent e = pm.getExtent(mydomain.MyClass.class, true); + Iterator iter=e.iterator(); + while (iter.hasNext()) + { + MyClass my_obj=(MyClass)iter.next(); + ... + } + + tx.commit(); +} +catch (Exception e) +{ + if (tx.isActive()) + { + tx.rollback(); + } +} +

    + The Extent interface is one of the ways to retrieve your objects. + The others use the Query interface, allowing more precise filtering over the + objects returned. +

    +
    +
    + + +

    + To update an object we firstly retrieve it, as above, and then we call any of its + mutator methods. For example +

    + +tx = pm.currentTransaction(); +try +{ + tx.begin(); + + Extent e = pm.getExtent(mydomain.MyClass.class, true); + Iterator iter=e.iterator(); + while (iter.hasNext()) + { + MyClass my_obj=(MyClass)iter.next(); + my_obj.setValue(25.0); // Change the value + ... + } + + tx.commit(); +} +catch (Exception e) +{ + if (tx.isActive()) + { + tx.rollback(); + } +} +

    + When setValue() is called on the persistent object this change is intercepted + by JDO and the value change will be automatically sent to the datastore ... transparently! +

    +
    +
    + + +

    + So we can persist objects, and retrieve them. Now we want to remove one from persistence. +

    + try +{ + tx = pm.currentTransaction(); + tx.begin(); + + ... (code to retrieve object in question) ... + + pm.deletePersistent(my_obj); + + tx.commit(); +} +catch (Exception e) +{ + if (tx.isActive()) + { + tx.rollback(); + } +} +
    +
    + + +

    + As we have seen in the JDO States guide, an object can + have many possible states. When we want to take an object and work on it, but removing + its identity we can make it transient. This means that it will retain the values + of its fields, yet will no longer be associated with the object in the datastore. + We do this as follows +

    + try +{ + tx = pm.currentTransaction(); + tx.begin(); + + ... (code to retrieve object in question) ... + + pm.makeTransient(my_obj); + + tx.commit(); +} +catch (Exception e) +{ + if (tx.isActive()) + { + tx.rollback(); + } +} + +... (code to work on "my_obj") +
    +
    + +
    \ No newline at end of file