code: public static void addTableSRIDConstraint(Connection connection, TableLocation tableLocation, int srid)
              throws SQLException {
          //Alter table to set the SRID constraint
          if (srid > 0) {
              connection.createStatement().execute(String.format("ALTER TABLE %s ADD CHECK ST_SRID(the_geom)=%d",
                      tableLocation.toString(), srid));
          }
      }
docs: Alter a table to add a SRID constraint.
  The srid must be greater than zero.
  
  @param connection Active connection
  @param tableLocation TableLocation of the table to update
  @param srid SRID to set
  
  @throws SQLException