Nathan/Chris,

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.

Thanks,

Gary


Christopher Schultz wrote:
Gary,

Gary Bentley wrote:
Along the lines of:

#foreach( $mud in $mudsOnSpecial where $customer.hasPurchased($mud) order by $mud.price)

This looks like mixing SQL-ish syntax with Java collections, which is precisely what JoSQL was designed to do. Why extend Velocity when you can simply use JoSQL as it was intended:

#foreach($mud in $josql.execute("SELECT [whatever] FROM mud.Type WHERE $customer.hasPurchased($mud)", $mudsOnSpecial))

... with with your muds

#end

then you just have to implement a JoSQL tool and shove it into the velocity context. You tool can do something like this:

public Iterator execute(String query, Object (or List?) source)
{
    Query q = new Query();
    q.parse(query);

    QueryResults qr = q.execute(source);


    List res = qr.getResults();

    return res.iterator();
}

I think this would be a whole lot easier than re-writing Velocity.

Since this capability is orthogonal to Velocity's, it seems to be a better choice for architecture, too.

-chris


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to