I have no objection to this proposal. I don't think we really need a
compatibility option, though. I can't think of a case where the user
is *depending* on an exception to be thrown that will suddenly fail
the application. TCK testing aside.
It is very close to being too late for 2.3, unless you can get
DataNucleus committers to agree to the change.
Craig
On Apr 8, 2010, at 8:07 AM, Matthew Adams wrote:
This seems like an excellent suggestion to me. +1.
2010/4/7 Marco หงุ่ยตระกูล-Schulze
<[email protected]>:
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:[email protected]
skype:matthewadams12
yahoo:matthewadams
aol:matthewadams12
google-talk:[email protected]
msn:[email protected]
http://matthewadams.me
http://www.linkedin.com/in/matthewadams
Craig L Russell
Architect, Oracle
http://db.apache.org/jdo
408 276-5638 mailto:[email protected]
P.S. A good JDO? O, Gasp!