Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to add a dynamic where clause for a sql based VO with group by query?

ChunyangDec 13 2012 — edited Dec 14 2012
Hi,

Here is my case, I have a sql query based VO with the query like "select status, count(*) StatusCount from my_table group by status". Now I used the following java code trying to dynamically add the where clause to my VO to filter the rows based the type attribute in my DB table.

vo.setWhereClause("type='MyType1' ");
vo.executeQuery();

Then I got the sql syntax error. Looks like the ADF has added the where clause to the end of my sql so my sql becomes "select status, count(*) StatusCount from my_table group by status where type='MyType1' ". But what I expected was the correct syntax "select status, count(*) StatusCount from my_table where type='MyType1' group by status".

Does anyone know if this is an ADF bug? Or is there any other way to achieve my goal?

Thanks,
Chunyang

Edited by: Chunyang on Dec 13, 2012 9:09 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2013
Added on Dec 13 2012
3 comments
1,968 views