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 Ali HACHAMI <ah...@gmail.com> on 2007/05/02 21:16:47 UTC

Using getReportQueryIteratorByQuery

 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?
Thanks in advance,

Ali

Re: Using getReportQueryIteratorByQuery

Posted by Armin Waibel <ar...@apache.org>.
Ali HACHAMI wrote:
> Hi Armin,
> 
> I did the test using 1.0.4.
>

I compared the sources from SVN with 1.0.4 and didn't found (much) 
differences in column handling via report query (SqlQueryStatement, 
ReportQueryByCriteria, ReportQueryRsIterator). So I would expect the 
same issue in latest version from SVN too.

Is it possible for you to run your test against the latest version from 
SVN (OJB_1_0_RELEASE branch!) or could you post detailed information to 
reproduce the test (test sources, test classes + mapping (only the 
mandatory columns/fields))?

regards,
Armin

> Best regards,
> 
> Ali
> 
> 
> On 5/11/07, Armin Waibel <ar...@apache.org> wrote:
>>
>> Hi Ali,
>>
>> Ali HACHAMI wrote:
>> > Hi Armin,
>> >
>> >
>> > I tried to fix the problem by renaming the class's attributes, but the
>> > problem is still there. In conclusion the problem happen when the
>> columns
>> > have the same name in the tables (not in the classes).
>> >
>>
>> In my test the java field name ("name") + column name ("NAME_") are the
>> same in both classes/tables.
>> Did you tried to fix the issue using 1.0.4 or did you tried the latest
>> version from SVN (OJB_1_0_RELEASE branch!)?
>>
>> regards,
>> Armin
>>
>> >
>> >
>> > Best regards,
>> >
>> > Ali
>> >
>> >
>> > On 5/5/07, Armin Waibel <ar...@apache.org> wrote:
>> >>
>> >> 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
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>>
>>
> 

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


Re: Using getReportQueryIteratorByQuery

Posted by Ali HACHAMI <ah...@gmail.com>.
Hi Armin,

I did the test using 1.0.4.

Best regards,

Ali


On 5/11/07, Armin Waibel <ar...@apache.org> wrote:
>
> Hi Ali,
>
> Ali HACHAMI wrote:
> > Hi Armin,
> >
> >
> > I tried to fix the problem by renaming the class's attributes, but the
> > problem is still there. In conclusion the problem happen when the
> columns
> > have the same name in the tables (not in the classes).
> >
>
> In my test the java field name ("name") + column name ("NAME_") are the
> same in both classes/tables.
> Did you tried to fix the issue using 1.0.4 or did you tried the latest
> version from SVN (OJB_1_0_RELEASE branch!)?
>
> regards,
> Armin
>
> >
> >
> > Best regards,
> >
> > Ali
> >
> >
> > On 5/5/07, Armin Waibel <ar...@apache.org> wrote:
> >>
> >> 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
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> 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: Using getReportQueryIteratorByQuery

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

Ali HACHAMI wrote:
> Hi Armin,
> 
> 
> I tried to fix the problem by renaming the class's attributes, but the
> problem is still there. In conclusion the problem happen when the columns
> have the same name in the tables (not in the classes).
> 

In my test the java field name ("name") + column name ("NAME_") are the 
same in both classes/tables.
Did you tried to fix the issue using 1.0.4 or did you tried the latest 
version from SVN (OJB_1_0_RELEASE branch!)?

regards,
Armin

> 
> 
> Best regards,
> 
> Ali
> 
> 
> On 5/5/07, Armin Waibel <ar...@apache.org> wrote:
>>
>> 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
>> >
>>
>> ---------------------------------------------------------------------
>> 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: Using getReportQueryIteratorByQuery

Posted by Ali HACHAMI <ah...@gmail.com>.
Hi Armin,


I tried to fix the problem by renaming the class's attributes, but the
problem is still there. In conclusion the problem happen when the columns
have the same name in the tables (not in the classes).



Best regards,

Ali


On 5/5/07, Armin Waibel <ar...@apache.org> wrote:
>
> 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
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>

Re: Using getReportQueryIteratorByQuery

Posted by Armin Waibel <ar...@apache.org>.
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
> 

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