public Object getObject(ExecutionContext ec, ResultSet resultSet, int[] exprIndex) { if (exprIndex == null) { return null; } Object datastoreValue = getDatastoreMapping(0).getObject(resultSet, exprIndex[0]); if (datastoreValue == null) { return null; } if (datastoreValue instanceof String) { TypeConverter conv = ec.getNucleusContext() .getTypeManager() .getTypeConverterForType(LocalTime.class, String.class); if (conv != null) { return conv.toMemberType(datastoreValue); } else { throw new NucleusUserException("This type doesn't support persistence as a String"); } } else if (datastoreValue instanceof Time) { Time time = (Time) datastoreValue; Calendar cal = Calendar.getInstance(); cal.setTime(time); LocalTime localTime = LocalTime.of( cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND), cal.get(Calendar.MILLISECOND) * 1000000); return localTime; } else { return null; } }