protected void disableNotNullConstraints() {
        Connection connection = null;
        Statement queryStatement = null;
        Statement alterStatement = null;
        ResultSet resultSet = null;
        try {
            connection = getSQLHandler().getDataSource().getConnection();
            queryStatement = connection.createStatement();
            alterStatement = connection.createStatement();

            // Do not remove PK constraints
            resultSet = queryStatement.executeQuery("select col.TABLE_NAME, "
              + "col.COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS col where "
              + "col.IS_NULLABLE = 'NO' and col.TABLE_SCHEMA = '"
              + getSchemaName() + "' " + "AND NOT EXISTS (select COLUMN_NAME "
              + "from INFORMATION_SCHEMA.INDEXES pk where pk.TABLE_NAME = "
              + "col.TABLE_NAME and pk.COLUMN_NAME = col.COLUMN_NAME and "
              + "pk.TABLE_SCHEMA = '" + getSchemaName()
              + "' AND pk.PRIMARY_KEY = TRUE)");
            while (resultSet.next()) {
                String tableName = resultSet.getString("TABLE_NAME");
                String columnName = resultSet.getString("COLUMN_NAME");
                alterStatement.executeUpdate("alter table "
                  + qualified(tableName) + " alter column " + quoted(columnName)
                  + " set null");
            }
        } catch (Exception e) {
            throw new UnitilsException("Error while disabling not null "
              + "constraints on schema " + getSchemaName(), e);
        } finally {
            closeQuietly(queryStatement);
            closeQuietly(connection, alterStatement, resultSet);
        }
    }
Disables all not null constraints on all tables in the schema
spock-unitils/src/test/java/org/unitils/core/dbsupport/H2DbSupport.java