Queries with nullable parameters discontinue to return data
-----------------------------------------------------------
Key: OPENJPA-2037
URL: https://issues.apache.org/jira/browse/OPENJPA-2037
Project: OpenJPA
Issue Type: Bug
Affects Versions: 2.1.1
Reporter: Sergey Razuvaev
We have a hierarchical table CT_LOCATION (database scheme and corresponding jpa
configuration are placed into table_scheme.gif and jpa_config.txt attachments)
There is a JPQL-query to get children by a parent location:
<named-query name="locationManagement.getLocations">
<query>select item from Location item where
item.superLocation.id = :locationSuperLocationId</query>
</named-query>
The parameter locationSuperLocationId can be set to NULL to return all root
locations. When we use following execution sequence the query discontinues to
return root items:
Step 1: Set locationSuperLocationId to NULL and get all root elements. Query
result is NOT EMPTY.
Step 2: Fill locationSuperLocationId with actual parent id and execute query.
Repeat this step TWO OR MORE TIMES.
Step 3: Set locationSuperLocationId to NULL again and get all root elements.
The query result will be EMPTY.
On step 1 openjpa uses IS NULL construction to get data from the database. But
on step 3 it does not. Execution log is placed in to execution_log.txt
atachment.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira