Re: Code in two table join

2004-04-23 Thread Jakob Braeuchi
hi wallace,

it's not necessary to join manually, ojb will do it for you:

Criteria crit = new Criteria();
ReportQueryByCriteria q = QueryFactory.newReportQuery(A.class, crit);
q.setAttributes(new String[] {"xxx", "yyy", "rel_b.zzz" });
Iterator it = broker.getReportQueryIteratorByQuery(q);

there must be a relationship-definition from class A to B named 'rel_b' in the 
repository.

jakob

Info wrote:

Hello,

I tried the following code to select a join, but get error:

   Criteria crit = new Criteria();
   crit.addEqualToColumn("A.xxx", "B.xxx");
   ReportQueryByCriteria q = 
QueryFactory.newReportQuery(A.class, crit);
  q.setAttributes(new String[] {"A.xxx", "A.yyy", 
"B.zzz" });

   Iterator it = broker.getReportQueryIteratorByQuery(q);

( In the case,  for string "A.xxx" or "B.zzz", what name should I use as 
A or B? The physical table name or class name represented or other name?)
SQL statement:

SELECT A.xxx, A.yyy, B.zzz
FROM A JOIN B
ON A.xxx = B.xxx
Please help!

Thanks!
Wallace
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Code in two table join

2004-04-23 Thread Info
Hello,

I tried the following code to select a join, but get error:

   Criteria crit = new Criteria();
   crit.addEqualToColumn("A.xxx", "B.xxx");
   ReportQueryByCriteria q = 
QueryFactory.newReportQuery(A.class, crit);
   
   q.setAttributes(new String[] {"A.xxx", "A.yyy", "B.zzz" });

   Iterator it = broker.getReportQueryIteratorByQuery(q);

( In the case,  for string "A.xxx" or "B.zzz", what name should I use as 
A or B? The physical table name or class name represented or other name?)
SQL statement:

SELECT A.xxx, A.yyy, B.zzz
FROM A JOIN B
ON A.xxx = B.xxx
Please help!

Thanks!
Wallace
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]