This diagnostics object informs you that a Native Query cannot be optimized. It means that it will be run by instantiating all objects of the candidate class. Try to simplify your query expression.
For an example let's look at a predicate using 2 different unrelated clauses.
01package com.db4odoc.f1.diagnostics; 02
03
import com.db4o.query.Predicate; 04
05
public class ArbitraryQuery extends Predicate<Pilot>{ 06
public int[] points; 07
08
public ArbitraryQuery(int[] points) { 09
this.points=points; 10
} 11
12
public boolean match(Pilot pilot) { 13
for (int i = 0; i < points.length; i++) { 14
if (((Pilot)pilot).getPoints() == points[i]) 15
{ 16
return true; 17
} 18
} 19
return ((Pilot)pilot).getName().startsWith("Rubens"); 20
} 21
22
23
}
1private static void queryPilot(ObjectContainer db){ 2
int[] i = new int[]{19,100}; 3
ObjectSet result = db.query(new ArbitraryQuery(i)); 4
listResult(result); 5
}
01public static void testArbitrary() { 02
Db4o.configure().diagnostic().addListener(new DiagnosticToConsole()); 03
new File(YAPFILENAME).delete(); 04
ObjectContainer db=Db4o.openFile(YAPFILENAME); 05
try { 06
Pilot pilot = new Pilot("Rubens Barrichello",99); 07
db.set(pilot); 08
queryPilot(db); 09
} 10
finally { 11
db.close(); 12
Db4o.configure().diagnostic().removeAllListeners(); 13
} 14
}