01
private static void storeCars() ...{
02
new File(DB4O_FILE_NAME).delete();
03
ObjectContainer container = database();
04
if (container != null) ...{
05
try ...{
06
Car car;
07
for (int i = 0; i < OBJECT_COUNT; i++) ...{
08
car = new Car("BMW", new Pilot("Test Pilot #" + i, i));
09
container.set(car);
10
}
11
for (int i = 0; i < OBJECT_COUNT; i++) ...{
12
car = new Car("Ferrari", new Pilot("Professional Pilot #"
13
+ (i + 10), (i + 10)));
14
container.set(car);
15
}
16
container.commit();
17
} catch (Db4oException ex) ...{
18
System.out.println("Db4o Exception: " + ex.getMessage());
19
} catch (Exception ex) ...{
20
System.out.println("System Exception: " + ex.getMessage());
21
} finally ...{
22
closeDatabase();
23
}
24
}
25
}