Results 1 to 2 of 2

Thread: Null parameter value handling improvement

  1. #1
    Join Date
    Jul 2005
    Location
    Austin, TX
    Posts
    137

    Smile Null parameter value handling improvement

    Null handling in query method parameters doesn't meet our needs, because it seems to always produce an "= NULL" clause in our queries, which always returns false. We need null parameter values to be ignored in the query.

    FYI, I've entered
    https://jira.springsource.org/browse/DATAJPA-209

    to track our enhancement request.

    Basically, it would allow something like this (notice @NullMeans annotation):
    Code:
    public interface FooRepository extends JpaRepository<Foo> {
      List<Foo> findByBarAndGoo(@NullMeans(IGNORED) Bar bar, @NullMeans(IGNORED) Goo goo);
    }
    Allowed values of @NullMeans are EQUALS (current behavior), IS (proposed) and IGNORED (proposed).

    WDYT?

    -matthew

  2. #2
    Join Date
    Jul 2005
    Location
    Austin, TX
    Posts
    137

    Exclamation

    NB: this is a shameless troll for votes since more folks follow the forum than the issue tracker.

    The "= NULL" v. "IS NULL" issue is indeed fixed in 1.1.0.RC1. However, the enhancement proposed in https://jira.springsource.org/browse/DATAJPA-209 (controlling null behavior) still holds, and the enum values are reduced to just IS and IGNORED.

    The SD JPA team is waiting for community feedback about and votes for the issue. If you feel that being able to control null handling behavior in queries with @NullMeans(IS) to produce "IS NULL" conditions (the current behavior) or @NullMeans(IGNORED) to exclude the condition from the query, then please vote for https://jira.springsource.org/browse/DATAJPA-209.

    -matthew

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •