-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Description
When extending AbstractMapping, if the propertyGetter function returns null then map... fails with NPE.
For example, mapDecimal() suggested fix:
protected void mapDecimal(String columnName, int precision, int scale, Func2<TEntity, BigDecimal> propertyGetter)
{
// We need to scale the incoming decimal, before writing it to SQL Server:
final Func2<TEntity, BigDecimal> wrapper = entity -> {
BigDecimal result = Optional.ofNullable(propertyGetter
.invoke(entity))
.map(d -> d.setScale(scale, BigDecimal.ROUND_HALF_UP))
.orElse(null);
return result;
};
addColumn(columnName, Types.DECIMAL, precision, scale, false, wrapper);
}
Reactions are currently unavailable