01: // You can redistribute this software and/or modify it under the terms of
02: // the Ozone Library License version 1 published by ozone-db.org.
03: //
04: // The original code and portions created by SMB are
05: // Copyright (C) 1997-2001 by SMB GmbH. All rights reserved.
06: //
07: // $Id: Client.java,v 1.1 2002/07/29 11:30:22 per_nyfelt Exp $
08:
09: package test.odmg;
10:
11: import java.io.*;
12: import org.odmg.*;
13: import org.ozoneDB.odmg.*;
14:
15: public class Client {
16:
17: public static Implementation odmg;
18:
19: public static void main(String[] args) throws Exception {
20: odmg = new OzoneODMG();
21: Database db = odmg.newDatabase();
22: db.open("ozonedb:remote://localhost:3333",
23: Database.OPEN_READ_WRITE);
24:
25: Transaction tx = odmg.newTransaction();
26: tx.begin();
27:
28: Auto auto = null;
29: try {
30: auto = (Auto) db.lookup("name");
31: } catch (Exception e) {
32: auto = new Auto("Name");
33: System.out.println(auto.getClass().getSuperclass()
34: .getName());
35: System.out.println(Thread.currentThread().getName() + ": "
36: + auto);
37: db.bind(auto, "name");
38: }
39:
40: auto.setName("Trabant");
41: System.out.println(Thread.currentThread().getName() + ": "
42: + auto);
43:
44: // db.deletePersistent (auto);
45:
46: tx.commit();
47:
48: db.close();
49: }
50: }
|