Re: Using getReportQueryIteratorByQuery

Armin Waibel <[email protected]>
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <[email protected]>
Hi Ali,

sorry for the late reply. Last week I had a DSL malfunction caused by my 
Internet provider. It seems to be fixed (works again for 20 hours), but 
it could happen that I'm out of business again.


Ali HACHAMI wrote:
> Hi,
> I'm using getReportQueryIteratorByQuery and I want to select columns that
> have the same name but are not present in my criteria :
> 
> 
> Criteria crit1 = new Criteria();
> crit1.addEqualTo("id", new Integer(1));
> 
> q = QueryFactory.newReportQuery(Container.class, crit1);
> 
> String[] cols = { id, "name", "refOtherClass.name "};
> q.setAttributes(cls);
> 
> The pb is that I'm getting the same value for the columns "name" and "
> refOtherClass.name".
> 
> Any help?

I try to reproduce your problem and setup a similar test with class 
Author and Publisher (1:1 relation Author-Publisher):

Query q = QueryFactory.newReportQuery(
Author.class, new String[]{"id", "name", "publisher.name"}, null, true);
Iterator result = broker.getReportQueryIteratorByQuery(q);
while(result.hasNext())
{
     System.out.println(ArrayUtils.toString(result.next()));
}

Result:
{200001,author_1_testA_1178367631953_,publisher_testA_1178367631953_}
{200002,author_2_testA_1178367631953_,publisher_testA_1178367631953_}
{200003,author_3_testA_1178367631953_,publisher_testA_1178367631953_}
{200004,author_4_testA_1178367631953_,publisher_testA_1178367631953_}

As you can see this works with latest version from SVN (OJB_1_0_RELEASE 
branch!). I don't try this test with OJB 1.0.4. So if it's a bug in 
1.0.4, it seems to be fixed in the next upcoming version of OJB.

If your problem still happens with latest from SVN, please post the 
mapping for class Container and the referenced class.

regards,
Armin


> Thanks in advance,
> 
> Ali
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.