spring-projects / spring-projects/spring-batch-extensions

startStatement() should not be required in Neo4jItemReader

Open
#113 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module: spring-batch-neo4j status: waiting-for-triage type: bug
Dominant language
Java
Stars
277
Forks
269
PR merge metrics
No merged PRs in 30d

Description

Bug description
In Neo4jItemReaderBuilder, startStatement(String startStatement) is required, but Neo4j itself deprecated the START statement and throw error when used. If not used, application will throw BeanCreationException with message java.lang.IllegalArgumentException: startStatement is required.

Environment
Spring Boot: 2.7.0
Kotlin: 1.6.10
Neo4j: 4.4.4

Steps to reproduce

@Bean
    fun postReader(): ItemReader<Post> {
        return Neo4jItemReaderBuilder<Post>()
            .name("postReader")
            .sessionFactory(getSessionFactory())
            .startStatement("")
            .matchStatement("(p:Post)")
            .returnStatement("p")
            .targetType(Post::class.java)
            .pageSize(1000)
            .build()
    }

Expected behavior
startStatement() should be optional, not mandatory.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating Neo4jItemReaderBuilder and read the validation around startStatement(String startStatement), then inspect any related builder tests. Reproduce the BeanCreationException with the shown configuration and verify that omitting startStatement allows the reader to build while matchStatement and returnStatement still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin, spring
Domain
database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.