Skip to content

Reject Limit parameter using String-based queries #1654

@christophstrobl

Description

@christophstrobl

It would be nice if data r2dbc supported the Limit parameter in repository finder methods.

@Query("select id, firstname, lastname from customer c where c.lastname = :lastname")
Flux<Customer> findByLastname(String lastname, Limit limit);

The following test currently fails, emitting more than one result.

service.save(new Customer(null, "Carter", "Matthews")) //
	.as(StepVerifier::create) //
	.expectNextMatches(Customer::hasId) //
	.verifyComplete();

service.save(new Customer(null, "Evad", "Matthews")) //
	.as(StepVerifier::create) //
	.expectNextMatches(Customer::hasId) //
	.verifyComplete();

repository.findByLastname("Matthews", Limit.of(1)) //
	.as(StepVerifier::create) //
	.expectNextCount(1)
	.verifyComplete();

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions