[
https://issues.apache.org/jira/browse/OPENJPA-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13048783#comment-13048783
]
Pinaki Poddar commented on OPENJPA-2016:
----------------------------------------
>From the patch,
> + String jpql = "SELECT o FROM simple o WHERE
> ((:nameDiscriminator=false) OR (o.name = :name))";
a) 'simple' is not an entity name -- or do you mean 'SimpleEntity'?
b) (:nameDiscriminator=false) -- that is interesting. The binding parameters
occur in right side of a predicate (generally)
Did you get this query executed, for the first time at least?
> OpenJPA sometimes incorrectly complains about wrong number of parameters
> ------------------------------------------------------------------------
>
> Key: OPENJPA-2016
> URL: https://issues.apache.org/jira/browse/OPENJPA-2016
> Project: OpenJPA
> Issue Type: Bug
> Affects Versions: 2.1.0, 2.2.0
> Environment: Windows XP, Sun JDK 1.6.0_24, Maven 2.2.1
> Reporter: Ognjen Blagojevic
> Attachments: discriminatorParameter.patch
>
>
> OpenJPA sometimes incorrectly complains about wrong number of parameters,
> e.g.:
> "47 test WARN [main] openjpa.Runtime - Supplied user parameters "[name,
> nameDiscriminator]" do not match expected parameters "[name]" for the
> prepared query "PreparedQuery: [SELECT o FROM simple o WHERE
> ((:nameDiscriminator=false) OR (o.name = :name))] --> [SELECT t0.ID, t0.NAME,
> t0.VALUE FROM SIMPLE_ENTITY t0 WHERE (1=0 OR t0.NAME = ?)]".
> I will add the patch to demonstrate the behavior. Run test at
> openjpa-persistence-jdbc, e.g:
> mvn -Dtest=TestQueryParameters test-compile test
> The query is intentionally executed twice, since only second execution yields
> warning message.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira