i have a query method. i use db40 in java
public static void checkQuery(ObjectContainer db, final String nameFish) {
ObjectSet result = db.query(new Predicate<WaterFish>() {
@Override
public boolean match(WaterFish fish) {
// TODO Auto-generated method stub
return fish.getGeneral_information().getVietnamese_name()
.contains("Ông tiên");
}
});
listResult(result);
}
result contains : fish{nameFish, distribution} and image. how i can get only nameFish field in fish object how i can get a only field in result ? thanks
db4o (at least until Jan/2012) can only load full objects. You can use some tricks like introduce a new class to hold data (fields) that you don't use very often and rely on transparent activation to load this data when required (something like the code below).
class FishData
{
private Image picture;
// other fields, getters / setters etc
}
class Fish
{
private string name;
private FishData data;
// other fields, getters / setters etc
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.