Hi all. I am newbie in Cayenne.
My application need is all the data from the database to be loaded into memory at application start.
So I have one static DataContex and load it using
SelectQuery query = new SelectQuery(SomeClass.class);
dataContext.performQuery(query);
............. // some similar queries
The loaded data is relational and everything works file for me.
But it looks logic for me to have method that retrieves all the DataObjects from DataContex that
are instances of some specific DataObject subclass.
So I decided to ask you about if there is any suitable method.
( I searched all info and API docs, but did not find something that fits my needs).
I made my own workaround
public Vector getDataObjects(Class c) {
List list = getDataContext().getObjectStore().getObjects();
Vector result = new Vector();
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getClass() == c) {
result.add(list.get(i));
}
}
return result;
}
but i do not like the idea very much.
Thanks in advance for every answer.
Regards Nenko Ivanov.
This archive was generated by hypermail 2.0.0 : Fri Feb 06 2004 - 07:47:42 EST