JWarp Persistence - Overview

What is the JWarp Persistence Framework

The JWarp persistence framework is an object/persistence mapping tool. If you implement the persistence drivers based on relational databases, you will get an O/R mapper. If you implement a persistence driver based on XML you have an object/XML mapping tool. The main features of it are the following:

A Small Code Snippet

In order to demonstrate how easy it is to use the JWarp Persistance interface, look at the following code snippet:

JDO jdo = new JDO();
jdo.configure
("file:///e:/Projects/JWarpPersistence/persistence/conf/persistence.xml");
Database sqlDB = null;

try{

jdo.getDatabase("sql");
sqlDB.begin();

TestItem loadedItem = (TestItem)sqlDB.get(new Object[]{new Integer(1)},"TestItem")
loadedItem.name = "New name";

sqlDB.update(loadedItem);
sqlDB.commit();

}
catch(Exception e){
}
finally{

sqlDB.commit();

}

 

If you use long transaction, the following code is already sufficient (the sample starts an updater that is checking all classes and is activated every 30 seconds):

JDO jdo = new JDO();
jdo.configure
("file:///e:/Projects/JWarpPersistence/persistence/conf/persistence.xml");
jdo.addUpdater("sql",30000);

Database sqlDB = null;
TestItem loadedItem = null;

try{

jdo.getDatabase("sql");
sqlDB.begin();

loadedItem = (TestItem)sqlDB.get(new Object[]{new Integer(1)},"TestItem")
sqlDB.commit();

}
catch(Exception e){
}
finally{

sqlDB.commit();

}

loadedItem.name = "New name";

 

 

Further Reading

There are several resources about the JWarp Persistence framework. Just follow the links...