Listing 1 Storing an object instance

ObjectContainer db=Db4o.openFile("C:/example.db");
try { // Saves three objects
   db.set(new Customer("Max Fisch",
             "TOP INC",25));
   db.set(new Customer("John Doe",
"NEW Ltd.",50));
   db.set(new Customer("Jane Doe",
"NEW Ltd.",35));

   ObjectSet result=db.get(new Customer());
   while(result.hasNext()) { // Show all
      System.out.println(result.next());
   }

   
   result=db.get(new Customer("Jane Doe"));
   Customer found = (Customer)
result.next();
   found.setAge(36); // Has birthday...
   db.set(found); // Store object again
   db.delete(found); // Had an accident...
   db.commit();
}
finally {
   db.close();
}

Listing 2 Native Query in C# 2.0

IList<Person> persons = db.Query<Person>(delegate(Person person) {
   return person.Salary < 1000;
}

Listing 3 Native Query in C# 3.0

var persons = db.Query<Person> (s => s.Salary < 1000);

Listing 4 Hibernate Criteria Query

List cats = sess.createCriteria(Cat.class)
    .add( Expression.like("name", "Fritz%"))
    .add( Expression.between("weight",
	minWeight, maxWeight))
    .list();

Listing 5 db4o Soda Query

Query query=db.query();
query.constrain(Person.class);
Constraint firstConstr = query.descend("_age").constrain(50).greater();
query.descend("_age").constrain(80).smaller().and(firstConstr);
ObjectSet result = query

db4o as well as other solutions always provides multiple query options that can adapt to specific query requirements.