Is it possible for you to post the snip of code that does the query? My guess is that you're doing something like this:
Here's one of my DAO methods in which the Exception is thrown:
public Collection findAllCategories() throws DataAccessException {
PersistenceBroker broker = null;
Collection results = null; QueryByCriteria query = new QueryByCriteria(CategoryVO.class, null);
query.setStartAtIndex(1); try {
broker = ServiceLocator.getInstance().findBroker();
results = broker.getCollectionByQuery(query);
} catch (ServiceLocatorException e) {
throw new DataAccessException("Bla Bla", e);
} finally {
if (broker != null) {
broker.close();
}
}
return results;
}Another one that doesn't work is this ( I followed an example in the book "Professional Struts Applications"):
public Collection findLatestAdditions() throws DataAccessException {
PersistenceBroker broker = null;
Collection results = new Vector(); Criteria criteria = new Criteria();
criteria.addOrderByDescending("id"); Query query = QueryFactory.newQuery(DocumentVO.class, criteria);
query.setStartAtIndex(1);
query.setEndAtIndex(MAXIMUM_LATESTADDITIONS - 1);
try {
broker = ServiceLocator.getInstance().findBroker();
results = (Collection) broker.getCollectionByQuery(query);
} catch (ServiceLocatorException e) {
} finally {
if (broker != null) {
broker.close();
}
}
return results; }
Criteria criteria = new Critetia();
criteria.addEqualTo("size", someValue);
Query query = new QueryByCriteria(classToQuery, criteria);
Collection result = pb.getCollectionByQuery(query);
No i'm not. And that's the strange thing. I'm not running any query on the size of a download.
Maybe the exception is thrown because DocumentVO doesn't have the _fileSize attribute but it also implements the SupportItemI Interface as does DownloadVO which has this attribute???? But if that was true queries on Interfaces wouldn't be very useful, right?
If so then the problem is that OJB queries are done against objects, not tables, there for you should change "size" to "_fileSize" or to the corresponding bean method name (depending on the value of PersistentFieldClass you defined in your OJB.properties file).
The PersistenceFieldClass is org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl (default)
Hope this helps, Luis Cruz
Thanks for your tips Luis! Any further ideas would be highly appreciated. Patrick
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
