问题描述:

ObjectContainer db=Db4o.openFile(Util.DB4OFILENAME);

db.get(); //doesn't exist

eclipse shows openFile is deprecitated with strike out.

I don't have get or set method.

网友答案:

The .get / .set method have been deprecated for a long time and been replaced by .store() and .query().

You're example should be like this, when using a query:

ObjectContainer db = Db4oEmbedded.openFile(Util.DB4OFILENAME);
db.query(new Predicate<MyClass>(){
      public boolean match(MyClass c){
            return c.getName().equals("Joe"); 
      }
})

What version of the tutorial are you using? Because it shouldn't have any get/set references in there.

网友答案:

I found this http://www.db4o.com/about/productinformation/resources/dRS-6.0-tutorial-java.pdf and looking at their use of DB4o.openFile(filename) it doesn't look like any get method is needed. I'm not experienced just did some looking up.

相关阅读:
Top