Methods Summary |
---|
public void | dump()
PersistenceManager pm = getPM();
Object[] data = new Object[3];
pm.retrieveAll(data);
for (int i = 0; i < data.length; i++) {
System.out.println(data[i]);
}
pm.close();
|
public javax.jdo.PersistenceManager | getPM()
Properties p = new Properties();
try {
p.load(new FileInputStream("jdo.properties"));
PersistenceManagerFactory pmf =
JDOHelper.getPersistenceManagerFactory(p);
return pmf.getPersistenceManager();
} catch (IOException ex) {
throw new RuntimeException(ex.toString());
}
|
public static void | main(java.lang.String[] args)
SerialDemoJDO jd = new SerialDemoJDO();
jd.save();
jd.dump();
|
public void | write(java.lang.Object o)
PersistenceManager pm = getPM();
pm.currentTransaction().begin();
if (o instanceof Collection) {
pm.makePersistentAll((Collection)o);
} else {
pm.makePersistent(o);
}
pm.currentTransaction().commit();
pm.close();
|