code: public static Geometry toGeometry(String wkt) throws SQLException {
          if(wkt == null) {
              return null;
          }
          WKTReader wktReader = new WKTReader();
          try {
              return wktReader.read(wkt);
          } catch (ParseException ex) {
              throw new SQLException("Cannot parse the WKT.",ex);
          }
      }
docs: Convert well known text parameter into a Geometry
  @param wkt Well known text
  @return Geometry instance or null if parameter is null
  @throws ParseException If wkt is invalid