@Override public Collection map(int index, ResultSet result, StatementContext statementContext) throws SQLException { Collection collection = new Collection((UUID) result.getObject("id")); collection.setParentId((UUID) result.getObject("parent_id")); collection.setSlug(result.getString("slug")); collection.setTitle(result.getString("title")); collection.setDescription(result.getString("description")); collection.setFeaturedImageId((UUID) result.getObject("featured_image_id")); if (MapperUtils.hasColumn("localization_data", result) && !Strings.isNullOrEmpty(result.getString("localization_data"))) { ObjectMapper mapper = new ObjectMapper(); try { Map<Locale, Map<String, Object>> localizedVersions = Maps.newHashMap(); Map[] data = mapper.readValue(result.getString("localization_data"), Map[].class); for (Map map : data) { localizedVersions.put(LocaleUtils.toLocale((String) map.get("locale")), (Map) map.get("entity")); } collection.setLocalizedVersions(localizedVersions); } catch (IOException e) { throw new SQLException("Failed to de-serialize localization JSON data", e); } } return collection; } }