hi everyone,
I'm trying to programmatically manipulate an HQL query. for example, given an HQL query, I'd like to produce a second query that counts the result set size of the first query.
I know that Criteria objects are an effective way to accomplish dynamically constructed queries, but please believe that starting with HQL instead is desirable in my circumstances.
The strategy I thought to use was:
1. use HqlParser to get an AST for the query source
2. manipulate the AST (add a select->count->pk subtree, for example)
3. regenerate HQL from the modified syntax tree.
it currently doesn't look like there's a tree walk algorithm that generates HQL from HQL. am I wrong about this? it seemed to me like someone else might have tried to do this already. any pointers or other suggestions?
i don't have significant ANTLR skills, so I'd like to avoid writing a HQL->HQL tree parser if possible.
thanks
jt
|