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 "Mills, Blake S CTR 805 CSPTS/SCE" <Bl...@scott.af.mil> on 2006/09/26 23:44:45 UTC

Need constant Object[] size from ReportQuery

Hello,
 
I am trying to use a ReportQuery because I only need a limited amount of
the data from a certain table.  Everything works great except the
Object[] size returned by the ReportQueryRsIterator changes depending on
if there are any null values.
 
For example if want two column values from your ReportQuery and one of
them is null, then the returned Object[] size will only one, NOT two.
How do you know which of the two columns is represented in the Object[]?
I would expect an Object[] with size two with null in the place of the
column that had no value.  Am I missing something?   Below is how I
setup the ReportQuery.
           
            broker.beginTransaction();
            Criteria criteria = new Criteria();
            criteria.addEqualTo("personAccountId", new
Integer(person.getId()));
 
            ReportQueryByCriteria reportQuery =
QueryFactory.newReportQuery(TaskView.class, criteria);
 
            String[] columns = new String[] {"warningThreshold",
"notApplicable", "dueDate", "doneDate"};
            reportQuery.setAttributes(columns);
 
            Iterator iterator =
broker.getReportQueryIteratorByQuery(reportQuery);
 
 
Thanks for the help,
 
Blake

RE: Need constant Object[] size from ReportQuery

Posted by "Mills, Blake S CTR 805 CSPTS/SCE" <Bl...@scott.af.mil>.
I forgot to mention that I am running the ReportQuery on a View(Oracle
db), not a normal table.  I don't know what difference that would make
when selecting.  When I have time I will trace the source code and find
out exactly what is happening.

Thanks anyway.

Blake

-----Original Message-----
From: Armin Waibel [mailto:arminw@apache.org] 
Sent: Thursday, September 28, 2006 7:32 AM
To: OJB Users List
Subject: Re: Need constant Object[] size from ReportQuery

Hi Blake,

Mills, Blake S CTR 805 CSPTS/SCE wrote:
> Hello,
>  
> I am trying to use a ReportQuery because I only need a limited amount 
> of the data from a certain table.  Everything works great except the 
> Object[] size returned by the ReportQueryRsIterator changes depending 
> on if there are any null values.
>  

I test this with latest from SVN (OJB_1_0_RELEASE branch) and can't
reproduce your problem.

Test result for QueryTest#testReportQueryNullFields
http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/or
g/apache/ojb/broker/QueryTest.java?view=markup

Result_1: {<null>,testReportQueryNullFields_1159443495281,2}
Result_2: {Robert,testReportQueryNullFields_1159443495281,1}
Result_2: {<null>,testReportQueryNullFields_1159443495281,2}

As you can see null-fields are included in the result.

regards,
Armin


> For example if want two column values from your ReportQuery and one of

> them is null, then the returned Object[] size will only one, NOT two.
> How do you know which of the two columns is represented in the
Object[]?
> I would expect an Object[] with size two with null in the place of the
> column that had no value.  Am I missing something?   Below is how I
> setup the ReportQuery.
>            
>             broker.beginTransaction();
>             Criteria criteria = new Criteria();
>             criteria.addEqualTo("personAccountId", new 
> Integer(person.getId()));
>  
>             ReportQueryByCriteria reportQuery = 
> QueryFactory.newReportQuery(TaskView.class, criteria);
>  
>             String[] columns = new String[] {"warningThreshold", 
> "notApplicable", "dueDate", "doneDate"};
>             reportQuery.setAttributes(columns);
>  
>             Iterator iterator =
> broker.getReportQueryIteratorByQuery(reportQuery);
>  
>  
> Thanks for the help,
>  
> Blake
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Need constant Object[] size from ReportQuery

Posted by Armin Waibel <ar...@apache.org>.
Hi Blake,

Mills, Blake S CTR 805 CSPTS/SCE wrote:
> Hello,
>  
> I am trying to use a ReportQuery because I only need a limited amount of
> the data from a certain table.  Everything works great except the
> Object[] size returned by the ReportQueryRsIterator changes depending on
> if there are any null values.
>  

I test this with latest from SVN (OJB_1_0_RELEASE branch) and can't 
reproduce your problem.

Test result for QueryTest#testReportQueryNullFields
http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/QueryTest.java?view=markup

Result_1: {<null>,testReportQueryNullFields_1159443495281,2}
Result_2: {Robert,testReportQueryNullFields_1159443495281,1}
Result_2: {<null>,testReportQueryNullFields_1159443495281,2}

As you can see null-fields are included in the result.

regards,
Armin


> For example if want two column values from your ReportQuery and one of
> them is null, then the returned Object[] size will only one, NOT two.
> How do you know which of the two columns is represented in the Object[]?
> I would expect an Object[] with size two with null in the place of the
> column that had no value.  Am I missing something?   Below is how I
> setup the ReportQuery.
>            
>             broker.beginTransaction();
>             Criteria criteria = new Criteria();
>             criteria.addEqualTo("personAccountId", new
> Integer(person.getId()));
>  
>             ReportQueryByCriteria reportQuery =
> QueryFactory.newReportQuery(TaskView.class, criteria);
>  
>             String[] columns = new String[] {"warningThreshold",
> "notApplicable", "dueDate", "doneDate"};
>             reportQuery.setAttributes(columns);
>  
>             Iterator iterator =
> broker.getReportQueryIteratorByQuery(reportQuery);
>  
>  
> Thanks for the help,
>  
> Blake
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org