![]() |
![]() |
The Speedo tutorial shows how to use Speedo to manage persistent
objects via the JDO specification. The tutorial consists of nine
steps. The seven first steps are programs to discover the jdo
features.
Steps 1-2 show how to use the basic JDO features such as making an
object persistent, updating and deleting it.
Step 3 deals with the mappping of java classes via the jdo file.
Steps 4-7 show how to use additional features such as retrieving
persistent objects using queries, the mapping of inherited object graph
and the definition of a fetch plan.
Step 8 illustrates the way to edit the speedo.properties file using the
eclipse plugin provided within the speedo distribution: JDO Driver
Properties Editor.
Step 9 demonstrates how Speedo can be integrated into application
servers as a resource
adapter.
The source code of the classes used throughout this tutorial is located in the org.objectweb.speedo.tutorial.pobjects package and its sub packages. These packages consist of the java classes and the jdo files associated. The source code of the applications is located in the org.objectweb.speedo.tutorial.appli package and its sub packages.
java -cp speedo.jar org.hsqldb.Server -database.0 mydb -dbname.0 xdb
java -cp speedo.jar org.hsqldb.util.DatabaseManager&Fill in the connection form as follows:
package org.objectweb.speedo.tutorial;Top
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManagerFactory;
/**
* This class enables to get a persistence manager factory from the speedo.properties file.
*/
public class TutorialHelper {
protected static PersistenceManagerFactory pmf = null;
public TutorialHelper(String propertiesFileName)throws IOException {
Properties p = new Properties();
p.load(new FileInputStream(propertiesFileName));
pmf = JDOHelper.getPersistenceManagerFactory(p);
System.out.println("PersistenceManagerFactory instanciated ("+ pmf.getConnectionURL() + ")");
}
public PersistenceManagerFactory getPMF(){
return pmf;
}
}