On Sun, Dec 20, 2009 at 6:06 AM, Joe Gooch <mrwiz...@k12system.com> wrote: ... > 2) Replace the empty ContextMap (bindings) with the actual passed in Map. > This provides other issues, for instance, casting without knowing the > original Generics.... Plus, I don't think iBatis should modify my original > map, which it would do almost immediately. (By injecting _parameter)
I'm not sure this would work without breaking other things. For dynamic SQL (or whatever you call it when you use <if> and <foreach> to determine the actual SQL at runtime), the number of JDBC parameters isn't known until iBATIS has the parameter values for the 'test' and 'collection' attributes for these elements. This means that iBATIS has to be able to add its own params into the map. > 3) Extend the ContextMap definition such that a map can be provided as a > delegate... Much the same way Defaults work in the java.util.Properties > object. Any call to ContextMap.get would first consult itself. If it finds a > value, return it. If it doesn't, then consult the "child" map (if non-null), > and return any value found. I'd also have to wrap containsKey and some other > items. I like this solution the most too. The ContextMap class is something I submitted as a fix for https://issues.apache.org/jira/browse/IBATIS-671 - and it seems reasonable to use it for this problem too. My only reservation with the patches you've provided is that they break the semantics of map (e.g. size() no longer returns a sensible value, keySet() doesn't return all valid keys, ...). However, since these values aren't available to the OGNL interpreter (that's the point of the ContextAccessor class), I don't see that being a problem. As for which patch is better, I'm indifferent. > 4) Provide some way to provide a Map decorator to DynamicContext... Or > redefine the Context with one that uses a CaseInsensitiveHashMap natively... Not sure what this would entail. Regards, Martin --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org