db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Adams <matt...@matthewadams.me>
Subject Re: Query.executeWithMap(...) should accept unused parameters
Date Thu, 08 Apr 2010 15:07:32 GMT
This seems like an excellent suggestion to me.  +1.

2010/4/7 Marco หงุ่ยตระกูล-Schulze <Marco@nightlabs.de>:
> Hello *,
>
> we're currently migrating to DataNucleus 2.1.0-m2-SNAPSHOT and hit an
> exception when calling javax.jdo.Query.executeWithMap(Map params)
> whenever not all parameters are used in the query. See this forum post
> for more details:
>
> <http://www.jpox.org/servlet/forum/viewthread_thread,6052>
>
>
> I just took a look at the JDO javadoc and saw that it says there, the
> declared parameters and the parameters passed to the execute method have
> to match exactly:
>
> <http://db.apache.org/jdo/api23/apidocs/javax/jdo/Query.html#executeWithMap%28java.util.Map%29>
>
>
> IMHO this is a feature making the use of JDO with dynamic queries (and
> implicit parameter declarations) more complicated than necessary. It
> would be more developer-friendly, if it was legal to pass more
> parameters than the ones actually used, because they don't harm and it
> removes the need for additional tracking logic (which parameter is used,
> which one isn't).
>
> I therefore recommend to relax the rule from exact match to "super-set",
> i.e. only these 2 requirements:
>
> 1) All declared parameters must exist in the params-map passed to the
> method executeWithMap(...).
> 2) All types of the declared parameters must match the ones passed to
> executeWithMap(...).
>
> For downward compatibility, I recommend introducing an option that can
> be passed to the PersistenceManagerFactory (in the properties). As a
> first idea, I recommend: javax.jdo.option.QueryParameterExactMatch (with
> values "true" and "false").
>
> Thanks a lot for consideration!
>
> Best regards, Marco :-)
>
>



-- 
mailto:matthew@matthewadams.me
skype:matthewadams12
yahoo:matthewadams
aol:matthewadams12
google-talk:matthewadams12@gmail.com
msn:matthew@matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams

Mime
View raw message