Skip to content

Neo4jQueryMethod checks whether a method belongs to a CypherDSL statement executor or not are to weak. #2261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
meistermeier opened this issue May 26, 2021 · 0 comments
Assignees
Labels
type: bug A general bug

Comments

@meistermeier
Copy link
Collaborator

@Test
void testPartTreeInStatementExecutor(@Autowired PersonRepository repository) {
	assertThat(repository.findByFirstName("A")).isNotNull();
}

with

interface PersonRepository extends
		Neo4jRepository<Person, Long>,
		CypherdslStatementExecutor<Person> {

	Person findByFirstName(String firstName);
}

throws

java.lang.IllegalArgumentException: The first parameter to a Cypher based method must be a statement. Object of class [java.lang.String] must be an instance of interface org.neo4j.cypherdsl.core.Statement

at CypherdslBasedQuery:80
@michael-simons michael-simons self-assigned this May 26, 2021
@michael-simons michael-simons added the type: bug A general bug label May 26, 2021
@michael-simons michael-simons changed the title Derived finder recognized as CypherDSL statement query Neo4jQueryMethod checks whether a method belongs to a CypherDSL statement executor or not are to weak. May 26, 2021
michael-simons added a commit that referenced this issue May 26, 2021
…statement executor.

This changes uses Spring's ClassUtils to test whether a specific method
belongs to `CypherdslStatementExecutor` or
`ReactiveCypherdslStatementExecutor` as criteria if it needs to be
executed as a `CypherdslBasedQuery` or not.

Before this only the declaring class was checked which is not enough, as
this will prevent all derived query methods from working in a repository
that extends `CypherdslStatementExecutor`.

This fixes #2261.
@michael-simons michael-simons added this to the 6.1.2 (2021.0.2) milestone May 26, 2021
michael-simons added a commit that referenced this issue Jun 21, 2021
The deep scanning by `ClassUtils` whether a class has a given method triggers type resolution of some reactive types that might not be present in non-reactive applications. Therefore the check must be separated for imperative and reactive code paths.
michael-simons added a commit that referenced this issue Jun 21, 2021
The deep scanning by `ClassUtils` whether a class has a given method triggers type resolution of some reactive types that might not be present in non-reactive applications. Therefore the check must be separated for imperative and reactive code paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants