You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by David Mitchell <da...@factorylogic.com> on 2003/02/13 18:51:28 UTC
report query question
I have a question regarding report queries.
What is the purpose of having to provide a OJB persistent class reference
when supplying the query code that will be
executed? I can see why you need to provide the following String array with
the names of the fields you want, but why do I
need to pass a specific persistent class type when creating the query?
In the java API docs for the ReportQueryByCriteria, the variable is named
"targetClass", as if that was the type of object that
the query is populating, but it ISNT really, is it? Could I just pass a null
in there in lieu of having to pretend that some real OJB
object applies to my query?
yours,
David Mitchell
+---------------------------------------------------------+
This message may contain confidential and/or privileged information. If you
are not the addressee or authorized to receive this for the addressee, you
must not use, copy, disclose or take any action based on this message or any
information herein. If you have received this message in error, please
advise the sender immediately by reply e-mail and delete this message.
Thank you for your cooperation.
+---------------------------------------------------------+
Re: report query question
Posted by Thomas Mahler <th...@web.de>.
Hi David,
David Mitchell wrote:
> I have a question regarding report queries.
>
> What is the purpose of having to provide a OJB persistent class reference
> when supplying the query code that will be
> executed? I can see why you need to provide the following String array with
> the names of the fields you want, but why do I
> need to pass a specific persistent class type when creating the query?
The reason is stated in the javadoc for
PersistenceBroker.getReportQueryIteratorByQuery(Query query):
Returns an Iterator that iterates Object[] calling the .next() method.
The Elements returned come from a SELECT ... WHERE sqlStatement
*The Class c is only used to provide the associated JDBC Connection*
OJB must know against which datasource a query should be performed. This
information is taken from the ClassDescriptor of class c.
> In the java API docs for the ReportQueryByCriteria, the variable is named
> "targetClass", as if that was the type of object that
> the query is populating, but it ISNT really, is it? Could I just pass a null
> in there in lieu of having to pretend that some real OJB
> object applies to my query?
Try it out. But IMO it will result in an error as OJB tries to lookup a
datasource from the ClassDescriptor of the class parameter.
If the parameter is null a NullPointerException could be a likely result...
cheers,
Thomas
>
> yours,
> David Mitchell
>
>
>
> +---------------------------------------------------------+
> This message may contain confidential and/or privileged information. If you
> are not the addressee or authorized to receive this for the addressee, you
> must not use, copy, disclose or take any action based on this message or any
> information herein. If you have received this message in error, please
> advise the sender immediately by reply e-mail and delete this message.
> Thank you for your cooperation.
> +---------------------------------------------------------+
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
Re: report query question
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi david,
the class is used to get the classdescriptor describing the table, the
columns etc. from repository.
field names are translated into column names using this descriptor.
hth
jakob
David Mitchell wrote:
> I have a question regarding report queries.
>
> What is the purpose of having to provide a OJB persistent class reference
>when supplying the query code that will be
>executed? I can see why you need to provide the following String array with
>the names of the fields you want, but why do I
>need to pass a specific persistent class type when creating the query?
>
> In the java API docs for the ReportQueryByCriteria, the variable is named
>"targetClass", as if that was the type of object that
>the query is populating, but it ISNT really, is it? Could I just pass a null
>in there in lieu of having to pretend that some real OJB
>object applies to my query?
>
> yours,
> David Mitchell
>
>
>
>+---------------------------------------------------------+
>This message may contain confidential and/or privileged information. If you
>are not the addressee or authorized to receive this for the addressee, you
>must not use, copy, disclose or take any action based on this message or any
>information herein. If you have received this message in error, please
>advise the sender immediately by reply e-mail and delete this message.
>Thank you for your cooperation.
>+---------------------------------------------------------+
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>