In the same time it means that 2 objects, for example, one created in the runtime and another retrieved from the database, with the same data (field values) won't be equal for db4o.
There are 2 ways to compare db4o objects by data:
using QBE;
implementing a suitable
equals
method.
Let's save an object to the database and try the above mentioned methods in practice.
01private static void storePilot() { 02
ObjectContainer container = database(); 03
if (container != null) { 04
try { 05
Pilot pilot = new Pilot("Kimi Raikkonnen", 100); 06
container.set(pilot); 07
} catch (Exception ex) { 08
System.out.println("System Exception: " + ex.getMessage()); 09
} finally { 10
closeDatabase(); 11
} 12
} 13
}