[ 
https://issues.apache.org/jira/browse/OPENJPA-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049111#comment-13049111
 ] 

Ognjen Blagojevic commented on OPENJPA-2016:
--------------------------------------------

Yes, query is executed both times.

a) "simple" is the name of the entity for class SimpleEntity. Please look at 
SimpleEntity.java:

@Entity(name = "simple")
@Table(name = "SIMPLE_ENTITY")
public class SimpleEntity implements Serializable {
...

In the mentioned test class (TestQueryParameters.java) there are similar 
queries ("select e from simple e...").


b) I also tested with the binding parameter on the right side, but the result 
is the same:

172  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 ((false = 
:nameDiscriminator) OR (o.name = :name))] --> [SELECT t0.ID, t0.NAME, t0.VALUE 
FROM  SIMPLE_ENTITY t0 WHERE (0=1 OR t0.NAME = ?)]".



> 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

        

Reply via email to