openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Catalina Wei (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-1750) Prepared query with enum parameter fails when query is cached
Date Fri, 20 Aug 2010 22:12:15 GMT

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

Catalina Wei commented on OPENJPA-1750:
---------------------------------------

Heikki,
1. please clarify, 
are you using collection-valued parameter ?
if yes, then the syntax should be:
           where  a.state in :STATE

otherwise, you are passing a single enum value, then IN predicate should be enclosed in parenthesis
          where a.state in (:STATE)
if you have more than one enum parameter, use common separator that looks like:

          where a.state IN (:STATE1, :STATE2, ...)
           
2. This problem chould have  resolved by OPENJPA-1719 and OPENJPA-1738
Could you try openjpa-2.1.0 SNAPSHOT, see if the problem still exists ?


> Prepared query with enum parameter fails when query is cached
> -------------------------------------------------------------
>
>                 Key: OPENJPA-1750
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1750
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.0.0
>            Reporter: Heikki Turakainen
>
> A prepared query with an enum parameter fails when exactly the same query is executed
again. In other words, it works once, when the query is not cached yet.
> The exception: org.springframework.dao.InvalidDataAccessApiUsageException: The specified
parameter of type " ... " is not a valid query parameter.
> An example query string is: 
> select distinct a from MyClass a where a.state in (:STATE)
> where the STATE is a list of enums.
> There is a temporary workaround to bypass the cache with
> query.setHint(QueryHints.HINT_IGNORE_PREPARED_QUERY, queryString);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message