IdGenerator in java
public class IdGenerator { private long maxId; public IdGenerator(long start) { maxId = start; } public long getNextId () { return ++maxId; } } // IdGenerator
DZone Snippets > ovhaag > java
11381 users tagging and storing useful source code snippets
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
Oliver Haag www.ohcon.de
public class IdGenerator { private long maxId; public IdGenerator(long start) { maxId = start; } public long getNextId () { return ++maxId; } } // IdGenerator
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