rzo1 opened a new pull request, #240:
URL: https://github.com/apache/openjpa/pull/240

   https://issues.apache.org/jira/browse/OPENJPA-3039
   
   **Stacked on #235 (OPENJPA-3030/3031).** Only the last commit belongs to 
this PR; it will be rebased once #235 is merged.
   
   On Derby, `WHERE :a = :b` failed with 42X35: JPQL parameters have no 
declared type, so `DBDictionary.comparison()` wrote no cast. `<>`, `<`, `>`, 
`BETWEEN` and an IN list of parameters failed the same way.
   
   - On databases with `requiresCastForComparisons` (Derby, DB2, HSQL), a 
comparison of two constants casts an untyped parameter to the type of its bound 
value.
   - Such queries are kept out of the prepared query cache, since the cast 
depends on the value (WHERE, HAVING, select list, group by, order by). 
Otherwise a rerun with another value type reuses the old cast.
   - `SQLBuffer` recorded a parameter that appears twice with another one in 
between (e.g. `:a BETWEEN :b AND x`) at the first position only, so a cached 
query kept an old value on any database. Each occurrence now has its own 
position.
   
   `TestUntypedParameterComparison` (16 tests: types, operators, reruns with 
other types, CASE in the select list) and `TestSQLBuffer`. Full suite passes on 
Derby and H2.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to