2

I'm trying to convert an old database system to Salesforce and have decided to try out the Database.com Java SDK.

I have recently hit problem that I can't seem to find a work around related to a JPQL Query when searching for NULL or empty dates.

E.g.

select t from table where t.expiryDate is NULL or t.expiryDate = :today

This causes the following exception:

Caused by: [InvalidFieldFault [ApiQueryFault [ApiFault  exceptionCode='INVALID_FIELD' exceptionMessage='
from Table__c p  where (( p.Expiry_Date__c = 'NULL' ) OR (
                              ^
ERROR at Row:1:Column:158
value of filter criterion for field 'Expiry_Date__c' must be of type date and should not be enclosed in quotes'
]
 row='1'
 column='158'
]
]

I'm assuming this is a bug in a beta release of the SDK as I don't believe it should be converting the NULL to a string, but please let me know otherwise and/or does anyone know a work around?

mmix
  • 6,057
  • 3
  • 39
  • 65
Brad
  • 43
  • 4
  • 1
    just a guess, did you try with `t.expiryDate = NULL`? – mmix Feb 14 '12 at 13:49
  • Worth a try, but no, that didn't work either. I've also tried replacing null with '' and also passing it as a named parameter (of which told me it was expecting NULL). – Brad Feb 14 '12 at 14:54
  • It seems like a serious bug to me (so much for their tests, one would imagine date is null should be in tests). Open a ticket? – mmix Feb 14 '12 at 15:09
  • Its conversion to soql appears to have a bug, the correct SOQL should be where p.expiry_date__c = null (which'll work fine), i've passed this onto the Java SDK team. – superfell Feb 14 '12 at 15:37
  • I created an issue for this: https://github.com/forcedotcom/java-sdk/issues/16. We will take a look at it asap. – Jesper J. Feb 14 '12 at 17:10
  • Issues has been resolved – j_simone Mar 07 '12 at 00:04

0 Answers0