建立複雜的對象關聯,在Versant數據庫中也很是容易,能夠直接理解爲內存對象的操做。node
public void createKnownPerson() {數據庫
TransSession session = DistributedDatabaseManager.getInstance()session
.createNewSession();spa
session.setDefaultDatabase("dbnodeb");對象
Person personA = new Person();內存
personA.setFirstName("AAF1");ci
personA.setLastName("AAL1");get
Person personB = new Person();it
personB.setFirstName("BBF1");io
personB.setLastName("BBL1");
personB.addFriend(personA);
Person personC = new Person();
personC.setFirstName("CCF1");
personC.setLastName("CCL1");
personC.addFriend(personB);
Person personD = new Person();
personD.setFirstName("DDF1");
personD.setLastName("DDL1");
personD.addFriend(personC);
session.makePersistent(personA, "dbnodea");
session.makePersistent(personB, "dbnodeb");
session.makePersistent(personC, "dbnodea");
session.makePersistent(personD, "dbnodeb");
System.out.println("Special Test Data created.");
session.commit();
}