[
https://issues.apache.org/jira/browse/DERBY-5629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13215661#comment-13215661
]
Kristian Waagan commented on DERBY-5629:
----------------------------------------
Thanks, Knut.
I guess many database systems has found that extension useful then.
For completeness, I think the reason why "null is null" comes up is because of
a prepared statement with "where ? is null".
I may have garbled this, but I see two issues here:
a) JPQL doesn't support casts.
b) Where does Hibernate get the column type VARBINARY from? (the column is of
type VARCHAR)
By using explicit casts you can get the query working when you have control of
the SQL, but it's harder when going through another query language. I think HQL
is okay, but not JPQL due to the lack of CAST.
I don't know if (b) is a bug in Hibernate or in Derby. It would have been
easier if I know where Hibernate got the column type from, as it could be a bug
in the meta data obtained from Derby. I also tried with the latest version of
Hibernate and Derby trunk, but got the same error.
> Queries with guarded null Parameter fail
> ----------------------------------------
>
> Key: DERBY-5629
> URL: https://issues.apache.org/jira/browse/DERBY-5629
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 10.8.2.2
> Environment: java version "1.6.0_30"
> Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
> Java HotSpot(TM) Client VM (build 20.5-b03, mixed mode, sharing)
> Reporter: Bernard
> Attachments: NullParameterHibernateDerbyMaven.zip
>
>
> Some test cases in the attached Maven project fail where a null parameter is
> passed in or a null value is coded in the query.
> In the context of this issue, a recently closed issue appears to be relevant:
> "Add support for setObject(<arg>, null)"
> https://issues.apache.org/jira/browse/DERBY-1938
> Some test cases in the attached project are Hibernate JPQL cases where
> Hibernate takes care of generating the SQL queries.
> I thought it was appropriate to make a few cases not only one so that the
> issue gets a little more test coverage.
> I also assume that issue DERBY-1938 aims to fix what we can see in these
> cases.
> This has become a major issue because it causes failure of a minimalistic
> JPQL query as shown at
> http://en.wikipedia.org/wiki/Java_Persistence_Query_Language#Examples
> that shows a JPQL query:
> SELECT a FROM Author a WHERE :lastName IS NULL OR LOWER(a.lastName) =
> :lastName
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira