i just commited the fix.
Charles Anthony wrote:
hi jakob,
Thanks for that; yes, it does solve my problem. As my colleagues say, "You're a star!".
:))
jakob
Sorry I couldn't be more help on guiding you to the underlying problem.
Cheers,
Charles.
-----Original Message----- From: Jakob Braeuchi [mailto:[EMAIL PROTECTED] Sent: 01 March 2004 20:46 To: OJB Users List Subject: Re: Criteria.setClassPath - the saga continues
hi charles,
i think i found the problem with the multi-segment path:
in SqlQueryStatement#getTableAlias there are two locations calling getItemClassDescriptor:
cld = getItemClassDescriptor(ord, attr);
the argument attr contains the last segment of the path only. change these lines to:
cld = getItemClassDescriptor(ord, attrPath);
this should imo work. please tell me whether it solves your problem.
jakob
Charles Anthony wrote:
Hi all,
Following my query last week, I've botched my query to use the
ojbConcreteClass directly. I now have a problem that the
generated SQL for
the following sample is incorrect :
Criteria criteria1 = new Criteria();
criteria1.addEqualTo("outPayment.agreement.ojbConcreteClass",
"aquarius.agreement.ServiceAgreement");
criteria1.addEqualTo("outPayment.agreement.clientNumber",
"0000001");
QueryByCriteria query =
QueryFactory.newQuery(OutPaymentDestination.class,
criteria1); query.addPathClass("outPayment.agreement", ServiceAgreement.class);
PersistenceBroker pb =
PersistenceBrokerFactory.defaultPersistenceBroker();
Collection results = pb.getCollectionByQuery(query);
Generated SQL :
SELECT [... a load of attributes] FROM OUTPAYMENTDESTINATION A0 INNER JOIN OUTPAYMENT A1 ON A0.OUTPAYMENTID=A1.ID INNER JOIN AGREEMENT A2 ON A1.AGREEMENTID=A2.ID WHERE (A2.OJBCONCRETECLASS = ? ) AND clientNumber = ?
the corrext SQL should have (I think) been
SELECT [... a load of attributes] FROM OUTPAYMENTDESTINATION A0 INNER JOIN OUTPAYMENT A1 ON A0.OUTPAYMENTID=A1.ID INNER JOIN AGREEMENT A2 ON A1.AGREEMENTID=A2.ID WHERE (A2.OJBCONCRETECLASS = ? ) AND (A2.CLIENTNUMBER = ?)
One Outpayment has many OutPaymentDestinations. One Agreement has many OutPayments A ServiceAgreement is a subclass of Agreement All agreements are mapped to the AGREEMENT table.
The clientNumber attribute is only available on
ServiceAgreement (and maps
to the CLIENTNUMBER attribute on the AGREEMENT table).
We want to do a query for all outpaymentdestinations for a
ServiceAgreement
with a client number of "0000001".
The path class hint is being used to pick the right table
up, but it seems
to fail on looking up up the column name, so that the
un-qualified attribute
name is added to the query.
Please Help !
Cheers,
Charles.
___________________________________________________________
HPD Software Ltd. - Helping Business Finance Business
Email terms and conditions: www.hpdsoftware.com/disclaimer
---------------------------------------------------------------------
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]
___________________________________________________________
HPD Software Ltd. - Helping Business Finance Business
Email terms and conditions: www.hpdsoftware.com/disclaimer
--------------------------------------------------------------------- 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]
