Search code examples
intellij-ideaspring-batch

Spring Batch and Intellij Plugin


When using JdbcTemplate in Intellij the IDE is smart enough to recognize and validate SQL statements against a database schema. I'm not able to get the same behavior from Intellij for JdbcCursorItemReader and the SQL used to create the Spring batch reader. Is there a setting or 'trick' to get Intellij to become aware of the SQL statements like the example below - just like Intellij does for JdbcTemplate?

    JdbcCursorItemReader<Person> reader = new JdbcCursorItemReader<>();
    reader.setDataSource(rosaDataSource);
    reader.setSql("SELECT email, id, created_on from users");
    reader.setRowMapper(new UserMapper());
    reader.setFetchSize(25);
    return reader;

Solution

  • Is there a setting or 'trick' to get Intellij to become aware of the SQL statements like the example below - just like Intellij does for JdbcTemplate?

    From the "Context Actions" popup menu, you can inject SQL language support in the query to get SQL specific completions, here is a screenshot:

    language

    sql