db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brendan Miller" <bmil...@dotster.com>
Subject Re: Wrong SQL generation from Criteria
Date Fri, 19 Oct 2007 22:14:02 GMT
> > > 
> > > But this still leaves me a "column ambiguously defined" error when using
> > > addJoin():
> > > 
> > >     crit.addJoin(TableAPeer.ColumnX, TableBPeer.ColumnG);
> > >     crit.addAscendingOrderByColumn(TableBPeer.ColumnQ);
> > >     crit.addAscendingOrderByColumn(TableBPeer.ColumnR);
> > >     List<TableB> tableBs = TableBPeer.doSelect(crit);
> > > 
> > > generates
> > > 
> > >     SELECT <..TableB fields> FROM TABLE_A, TABLE_B, DBSCHEMA.TABLE_B
WHERE TABLE_A.COLUMN_X=TABLE_B.COLUMN_G ORDER BY TABLE_B.COLUMN_Q ASC, TABLE_B.COLUMN_R ASC
> > > 
> > > Where does the extra DBSCHEMA.TABLENAME come from?  

I'm getting this again (wrote some more code like the above), this time
without any addAscending...:

Criteria crit = new Criteria();
crit.addJoin(TransactionPeer.ORDER_ID, OrderPeer.ID);
crit.add(TransactionPeer.ACCT_ID, account.getID());
List<Order> orders = OrderPeer.doSelect(crit);

generates

SELECT <..ORDERS columns..> FROM TRANSACTION, ORDERS, DBSCHEMA.ORDERS, DBSCHEMA.TRANSACTION

WHERE TRANSACTION.ORDER_ID=ORDERS.ID AND TRANSACTION.ACCT_ID= ?

It seems that SQLBuilder.processJoins does not add the full table names, and 
SQLBuilder.processCriterions does.  What am I doing wrong?

Brendan

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


Mime
View raw message