Hi Chris,
For the class name, it's needed because during the parse it uses the
class name to resolve method/field accesses. Without it resolution
would be needed at execution time. In theory it's not needed but it
also allows the query to be parsed into the relevant tree of objects so
that it can be reused for execution. It also has the benefit of making
the query more readable to humans, so if you pass the query around
others can tell what class it is operating on. There is one issue, you
said that the tool is put into the application scope, however JoSQL
isn't thread safe, is it possible to get the tool to be created per
thread? (I could however use a query pool and normalize the query
string if not)
I do have plans for a future enhancement to allow a bind variable to be
used of a class name instead so that it can be more dynamic.
Thanks again for all the advice, I'll let you know when the tool is
available.
Gary
Christopher Schultz wrote:
Gary,
Gary Bentley wrote:
Many thanks for the responses. They are both very helpful. I think
at this point I'll go for Chris's suggestion since that will be
easier to implement. There are some differences between the way that
JoSQL and Velocity works so there will be limitations but overall I
think it will be easier this way.
I think they can complement each other very well: JoSQL seems very
self-contained, so you can easily create a re-usable "tool" that is
shareable across Context instances (Velocity Tools will put a tool
like this into "application" scope for a webapp), and Velocity
operates on any collection/iterator/array of objects generically.
So, you can simply write a method that takes one collection of objects
and emits another one (or an iterator) and use it directly.
Show us what you've got when you've got it. Your tool definitely looks
very interesting (though I'm not sure why you have to SELECT * FROM
[class name]... I suppose you needed something in there!).
Good luck,
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]