1 9 package test.odmg; 10 11 import java.io.*; 12 import org.odmg.*; 13 import org.ozoneDB.odmg.*; 14 15 16 public class Client { 17 18 public static Implementation odmg; 19 20 21 public static void main( String [] args ) throws Exception { 22 odmg = new OzoneODMG(); 23 Database db = odmg.newDatabase(); 24 db.open( "ozonedb:remote://localhost:3333", Database.OPEN_READ_WRITE ); 25 26 Transaction tx = odmg.newTransaction(); 27 tx.begin(); 28 29 Auto auto = null; 30 try { 31 auto = (Auto)db.lookup( "name" ); 32 } catch (Exception e) { 33 auto = new Auto( "Name" ); 34 System.out.println( auto.getClass().getSuperclass().getName() ); 35 System.out.println( Thread.currentThread().getName() + ": " + auto ); 36 db.bind( auto, "name" ); 37 } 38 39 auto.setName( "Trabant" ); 40 System.out.println( Thread.currentThread().getName() + ": " + auto ); 41 42 44 tx.commit(); 45 46 db.close(); 47 } 48 } 49 | Popular Tags |