1 package org.apache.ojb.ejb.odmg; 2 3 import org.apache.ojb.odmg.OJB; 4 import org.odmg.Database; 5 import org.odmg.Implementation; 6 import org.odmg.ODMGException; 7 8 22 23 31 public class ODMGHelper 32 { 33 public static final String DEF_DATABASE_NAME = "default"; 34 private static Implementation odmg; 35 private static Database db; 36 37 static 38 { 39 odmg = OJB.getInstance(); 40 db = odmg.newDatabase(); 41 try 42 { 43 System.out.println("[ODMG] Open new database " + db + " using databaseName name " + DEF_DATABASE_NAME); 44 db.open(DEF_DATABASE_NAME, Database.OPEN_READ_WRITE); 45 } 46 catch (ODMGException e) 47 { 48 e.printStackTrace(); 49 } 50 } 51 52 public static Implementation getODMG() 53 { 54 return odmg; 55 } 56 57 static Database getDatabase() 58 { 59 return db; 60 } 61 } 62 | Popular Tags |