hi ryan,
i executed the following query without any problems:
Query query;
String sql;
System.out.println("\nread persons (*) with name like '%er'");
sql = "select * from tabPerson where name like '%er%' order by id";
query = new QueryBySQL(Person.class, sql);
broker.getCollectionByQuery(query);
producing this result:
1041973534906|16|0|statement||select * from tabPerson where name like '%er%'
order by id
the sql-string is passed to the database without any modifications.
i used the latest from repository.
jakob
----- Original Message -----
From: "Ryan Vanderwerf" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, January 07, 2003 6:00 PM
Subject: 0.9.8: QueryBySQL broken on ORDER BY?
I'm passing some manual SQL into the QueryBySQL class that worked in
0.9.7 that seems broken in 0.9.8 - it seems to be re-parsing my query
and turning it into a select count(*) from a select *. For example I
pass it the following SQL:
select * from MDP_V_USR_APP, MDP_ANSWERS A6_0 WHERE PENDING_FLAG = 'N'
AND CATALOG_FLAG = 'Y' AND ((APPLICATION_ID in (select ENTITY_ID from
MDP_ANSWERS where FREEFORM like '%%' and ENTITY_TABLE_ID = 3)) or
APPLICATION_NAME like '%%' or APPLICATION_DESCRIPTION like '%%' or
FIRST_NAME like '%%' or LAST_NAME like '%%') AND
(A6_0.ENTITY_ID=APPLICATION_ID AND A6_0.ENTITY_TABLE_ID=3 AND
A6_0.POSSIBLE_ANSWER_ID=162) order by APPLICATION_NAME
Results in:
1041954266766|3|10|statement||select count(*) from MDP_V_USR_APP,
MDP_ANSWERS A6_0 WHERE PENDING_FLAG = 'N' AND CATALOG_FLAG = 'Y' AND
((APPLICATION_ID in (select ENTITY_ID from MDP_ANSWERS where FREEFORM
like '%%' and ENTITY_TABLE_ID = 3)) or APPLICATION_NAME like '%%' or
APPLICATION_DESCRIPTION like '%%' or FIRST_NAME like '%%' or LAST_NAME
like '%%') AND (A6_0.ENTITY_ID=APPLICATION_ID AND A6_0.ENTITY_TABLE_ID=3
AND A6_0.POSSIBLE_ANSWER_ID=162) order by APPLICATION_NAME
which throws a nice sql exception of course, since why would you user
ORDER BY on a count.
In 0.9.7 it generates this (which works):
1041953920242|71|6|statement||select * from MDP_V_USR_APP, MDP_ANSWERS
A6_0 WHERE PENDING_FLAG = 'N' AND CATALOG_FLAG = 'Y' AND
((APPLICATION_ID in (select ENTITY_ID from MDP_ANSWERS where FREEFORM
like '%%' and ENTITY_TABLE_ID = 3)) or APPLICATION_NAME like '%%' or
APPLICATION_DESCRIPTION like '%%' or FIRST_NAME like '%%' or LAST_NAME
like '%%') AND (A6_0.ENTITY_ID=APPLICATION_ID AND A6_0.ENTITY_TABLE_ID=3
AND A6_0.POSSIBLE_ANSWER_ID=162) order by APPLICATION_NAME
This is also happening in other places where I use that class and pass
in a query with an ORDER BY.
Any ideas on what functionality changed in QueryBySQL between .97 and
.98?
Ryan
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>