Versant數據庫能夠很容易地建立對象,並保存到數據庫中。node
TransSession session = DistributedDatabaseManager.getInstance()數據庫
.createNewSession();session
session.setDefaultDatabase("dbnodeb");dom
// TransSession session = new TransSession("dbnodea");spa
/**對象
* generate 500 random objectsget
*/it
for (int i = 0; i < 1500; i++) {io
Person person = new Person();ast
person.setFirstName("TFistName" + i);
person.setLastName("TListName" + i);
// set storage schema
DistributedDatabaseManager.getInstance()
.setRoundRobinPersistentSchema();
session.makePersistent(person);
session.commit();
}
System.out.println("Demo data generated.");
session.commit();