My object disappear when I restart ozone.
Ozone Apirak <[email protected]>
| Newsgroups | gmane.comp.java.ozone.user |
|---|---|
| Message-ID | <[email protected]> |
Hi
I really need your help. my program working very well if I did not
shutdown it. I can create insert delete. I can restart my application
and reconnect to my database but when I restart ozone my database will
disappear. I can't get object from "db.objectForName(ObjName);". It
return null.
this is my init and main method
public void init(OzoneInterface database){
db = database;
String name = MetCollectionImpl.class.getName();
Object obj = null;
try{
System.out.println("looking Object name "+ObjName+" from db");
obj = db.objectForName(ObjName);
metc = (MetCollection)obj;
System.out.println("get "+metc.getName()+" read ");
testRead();
testReadComplicate(); testDelete();
}catch(Exception e){
try { //Create new DB
System.out.println("can't looking for object because:
"+e);
obj = db.createObject(name, 0,ObjName);
System.out.println("create obj name:"+ obj);
metc = (MetCollection) obj;
metc.setName("OzoneMetBroker2");
System.out.println("ObjectDB name: "+metc.getName()+" was
created by me");
testCreate();
} catch(Exception e2) {
System.out.println("Can't create DB: "+ e2);
}
}
}
public static void main(String[] args) throws Exception{
System.out.println("Start Local");
String dbDir = "/java/testozone/ozon";
System.out.println("Opening database at "+ dbDir);
LocalDatabase database = new LocalDatabase(); if
(!database.exists(dbDir)){
database.create(dbDir);
}
database.open(dbDir, OzoneDebugLevel.ERROR_STR);
database.reloadClasses();
System.out.println("connect to ozone complete: "+database);
MetTest msi = new MetTest();
msi.init(database);
System.out.println("end test");
}
please give me some suggestion or some comment what should be wrong in
my code.
Thank you very much.
Apirak Panatkool
e-mail [email protected]
phone 01-4033320
testozone.tar.gz
(application/x-gzip, 41.4 KB) - not displayed