是的,是的,但是您需要使用Postgres特定的API。在上面的代码中,您需要将from / to方法替换为以下内容:
@Overridepublic ObjectNode from(Object databaseObject) { if (databaseObject == null) { return null; } try { PGobject dbo = (PGobject) databaseObject; return mapper.readValue(dbo.getValue(), ObjectNode.class); } catch (IOException e) { throw new RuntimeException(e); }}@Overridepublic Object to(ObjectNode userObject) { if (userObject == null) { return null; } try { PGobject dbo = new PGobject(); dbo.setType("json"); dbo.setValue(mapper.writevalueAsString(userObject)); return dbo; } catch (JsonProcessingException|SQLException e) { throw new RuntimeException(e); }}


