cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

My API-Call:


https://apisalesdemo8.successfactors.com/odata/v2/EmployeeTime?$select=userId,timeType,timeTypeNav/e...

The result is:


I am using odata-generator maven plugin to generate classes from edmx file.

And this is how I do the query in code:

        final List<EmployeeTime> employeeTimes =
                new DefaultEmployeeTimeService().withServicePath("/odata/v2/")
                .getAllEmployeeTime()
                .select(
                    EmployeeTime.USER_ID, 
                    EmployeeTime.TIME_TYPE, 
                    EmployeeTime.EXTERNAL_CODE, 
                    EmployeeTime.START_DATE, 
                    EmployeeTime.START_TIME, 
                    EmployeeTime.END_DATE, 
                    EmployeeTime.END_TIME)
                .top(10)
                .executeRequest(httpDestination);

I would like to filter the start date with value null. So my code is:

 final List<EmployeeTime> employeeTimes =
                new DefaultEmployeeTimeService().withServicePath("/odata/v2/")
                .getAllEmployeeTime()
                .select(
                    EmployeeTime.USER_ID, 
                    EmployeeTime.TIME_TYPE, 
                    EmployeeTime.EXTERNAL_CODE, 
                    EmployeeTime.START_DATE, 
                    EmployeeTime.START_TIME, 
                    EmployeeTime.END_DATE, 
                    EmployeeTime.END_TIME)

                 .filter(EmployeeTime.START_TIME.eq(null)
 
                .top(10)
                .executeRequest(httpDestination);

but I got an error:

com.sap.cds.services.impl.ContextualizedServiceException: Cannot invoke "Object.getClass()" because "value" is null (service 'EmployeeTimeService', event 'READ', entity 'EmployeeTimeService.EmployeeTime')

Does it not support filter with value null?

This is the code in oDataType.class (com.sap.cloud.sdk.odatav2.connectivity) which caused the problem.

0 Likes
View Entire Topic
former_member186608
Active Participant
0 Likes

Hi Edwin,

SAP Cloud SDK 3.45.0 fixes this issue.

Refer to the release notes for further reference.

Kind regards

Marco Dahms

idefix
Participant
0 Likes

Thank you Marco, it works!