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]