Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

save Data with db4o (See related posts)

// save Data with db4o

import com.db4o.Db4o;
import com.db4o.ObjectContainer;
import com.db4o.ObjectSet;
import com.db4o.query.Query;
...

public class DbUtil {

  /**
  * save someObject to DB
  */
  public static void saveData(SomeClass someObject, String DbFilename) {
    ObjectContainer db=Db4o.openFile(DbFilename);
    try {
      db.set(idGenerator);
    }
    finally {
      db.close();
    }
  } //saveData(SomeClass ..)

  ..

} //DbUtil

Comments on this post

llucifer posts on Oct 12, 2006 at 10:30
idGenerator is an invalid identifier...

You need to create an account or log in to post comments to this site.


Click here to browse all 5140 code snippets

Related Posts