Closed
Description
Wim Deblauwe opened DATACMNS-1762 and commented
Suppose a projection like this:
public interface UserRepository extends CrudRepository<User, UserId> {
@Query("SELECT u.name as name, u.gender as gender FROM user u")
UserInfo findById(UserId id);
}
with:
public interface UserInfo {
String getName();
Optional<Gender> getGender();
}
When I currently try this, I get null
back instead of Optional.empty()
if u.gender
is null
in the database.
It would be nice if this was possible.
As a "workaround", I define the projection as:
public interface UserInfo {
String getName();
@Nullable
Gender getGender();
}
Affects: 2.2.8 (Moore SR8)
Issue Links:
- DATACMNS-1836 Native projection stopped working with Java8 datetime
Referenced from: pull request #459