0

I try to repeat the code from the course. SQL queries should be created for initialization and run in public void setup(), but I faced with some problems:

  1. Cannot resolve method 'execute' in 'DatabaseClient'
  2. Reference to 'create' is ambiguous, both 'create(Publisher<? extends T>)' and 'create(Publisher<? extends T>, long)' match

code

  @BeforeAll
    public void setup() {

        Hooks.onOperatorDebug();

        List<String> statements = Arrays.asList(//
                "DROP TABLE IF EXISTS player;",
                "CREATE table player (id INT AUTO_INCREMENT NOT NULL, name VARCHAR2, age INT NOT NULL);");

        statements.forEach(it -> client.execute(it) //
                .fetch() //
                .rowsUpdated() //
                .as(StepVerifier::create) //
                .expectNextCount(1) //
                .verifyComplete());

    }

1 Answers1

1

I'm guessing that you are using the latest Spring version where certain R2DBC classes were deprecated. Check it here https://docs.spring.io/spring-data/r2dbc/docs/current/reference/html/#upgrading.1.1-1.2.deprecation

So either you should use .sql() instead of .execute() or just downgrade Spring/R2DBC version

Pawel
  • 466
  • 1
  • 7
  • 20