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 ma...@mpsa.com on 2005/09/01 11:13:11 UTC

Réf. : complex group, or subquery, or ... ?




Hi,
you need to define relationship between T1 / T2  and T1/T3 then use the
attribute name for the field (as defined in your repository_user.xml).
For instance :
T1: class Foo, attribute id <--> F1, with a relationship fooBar1 to the
class Bar1 and  with a relationship fooBar2 to the class Bar2
T2: class Bar1,
T3: class Bar2,
your attributes for the reportQuery are :
String [] attributes ={"id","count(fooBar1)","count(fooBar2)"};

 Cordialement

Matthieu PATOU

DINQ/DSIN/SIDM/VNVO/VOIN
Téléphone 01 30 19 17 91  (29 17 91)



                                                                           
             "Manukyan,                                                    
             Sergey"                                                       
             <SManukyan@lear.                                         Pour 
             com>                      ojb-user@db.apache.org              
                                                                        cc 
             30/08/2005 18:33                                              
                                                                     Objet 
                                       complex group, or subquery, or ...  
                 Veuillez              ?                                   
                répondre à                                                 
              OJB Users List                                               
             <ojb-user@db.apa                                              
                 che.org>                                                  
                                                                           
                                                                           





Folks,




I have three tables:




TABLE (FIELDS,...) : {(DATA),...}

----------------------------------------------

T1 (F1) : {(1)}

T2 (F1,F2) : {(1,1),(1,2)}

T3 (F1,F3) : {(1,10),(1,20),(1,30)}




Need to make a report query to select :




F1, count(T2), count(T3),




So in given example need a result to be:




1, 2 , 3




I attempted to do it in the flowing way but it evidently didn't' work:




ReportQueryByCriteria qry = QueryFactory.newReportQuery(T1.class, null);

qry.setColumns(new String[] {

                        "F1",

                        "count(T2.*)",

"count(T3.*)"

}




qry.addGroupBy(new String[] {

                        "F1"

}




Can I use subqueries to do it? If so can anyone please give me a hint
how I can do it, or point me in some other way I can do it with OJB,




Thank you in advance,




Sergey






**********************
** LEGAL DISCLAIMER **
**********************

This E-mail message and any attachments may contain

legally privileged, confidential or proprietary

information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of

this message to the intended recipient(s), you are

hereby notified that any dissemination, distribution

or copying of this E-mail message is strictly

prohibited. If you have received this message in

error, please immediately notify the sender and

delete this E-mail message from your computer.


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