AFAIK the documentation on OJB queries (query.html) mentions that:
1. if you use getObjectByQuery, getCollectionByQuery or getIteratorByQuery OJB materializes complete instances of your persistant class. Thus a SQL query must contain all fields defined in the repository.
2. if you want to use arbitrary Select statements, that do not contain all fields of a class, you have to use ReportQueries.
cheers, Thomas
Sng Wee Jim wrote:
Hi,
Thanks Roland. I managed to get what is needed (ie. only selected columns) by QueryBySQL query1 = QueryFactory.newQuery(java.lang.Class, sql) ; Iterator itr = broker.getReportQueryIteratorByQuery(query1);
maybe the FAQ section that mentions QueryBySQL should be updated to mention this.
- Jim
Roland Carlsson wrote:
I just did a QueryBySQL and after a little work I got to the following
conclusion.
All non-primary-key fields MUST be returned by the query. Primay-key fields
may be returned but it not a requirerment.
I guess that it is a design-choice to force the developer to use as complete
objects as possible. You should not get objects where most fields are null unless they are that in the database.
Regards Roland Carlsson
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]