Skip to content
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

query options from matching(query) not used by ReactiveFindByQueryOperationSupport.all() #1544

Open
mikereiche opened this issue Aug 24, 2022 · 3 comments
Assignees
Labels
type: bug A general bug

Comments

@mikereiche
Copy link
Collaborator

query options from matching(query) not used by ReactiveFindByQueryOperationSupport.all()


	@Test
	@Disabled
	void mmm() {
		JsonObject queryPlaceholderValues = JsonValue.jo();
		queryPlaceholderValues.put("$one", "a");
		queryPlaceholderValues.put("$two", "two");
		QueryScanConsistency scanConsistency = REQUEST_PLUS;
		N1QLExpression expression = N1QLExpression.x("select * from my_bucket where firstname = $one and lastname = $two");
		N1QLQuery query = buildQueryParams(expression, queryPlaceholderValues, scanConsistency);
		// query.getOptions() doesn't get copied
		couchbaseTemplate.findByQuery(User.class).matching(query).all();
	}

	public static N1QLQuery buildQueryParams(N1QLExpression expression, JsonValue queryPlaceholderValues,
			QueryScanConsistency scanConsistency) {
		QueryOptions opts = QueryOptions.queryOptions().scanConsistency(scanConsistency); // put the placeholders in the
																																											// options","
		if (queryPlaceholderValues instanceof JsonObject && !((JsonObject) queryPlaceholderValues).isEmpty()) {
			opts.parameters((JsonObject) queryPlaceholderValues);
		} else if (queryPlaceholderValues instanceof JsonArray && !((JsonArray) queryPlaceholderValues).isEmpty()) {
			opts.parameters((JsonArray) queryPlaceholderValues);
		}
		return new N1QLQuery(expression, opts);
	}
@mikereiche mikereiche added the type: bug A general bug label Aug 24, 2022
@mikereiche mikereiche self-assigned this Aug 24, 2022
@achheman
Copy link

achheman commented Sep 12, 2023

hi @mikereiche , any updates on this issue ?

I am writing an Integration test with couchbase repositories and I am seeing this error -

'void com.couchbase.client.java.query.QueryOptions$Built.injectParams(com.couchbase.client.java.json.JsonObject)'
java.lang.NoSuchMethodError: 'void com.couchbase.client.java.query.QueryOptions$Built.injectParams(com.couchbase.client.java.json.JsonObject)'

The above error looks related to the current bug.

I am using couchbase test container 1.18.3
spring boot couchbase starter lib (tried with both reactive and non reactive latest)
using the couchbase java sdk that comes with the spring couchbase starter

Apparently this is an issue only during Integration test and from the actual application we are able to pass query params to n1q1 queries and get the data. Can you please suggest any workaround ?

thanks

@mikereiche
Copy link
Collaborator Author

The Couchbase Java SDK version does not match the Spring Data Couchbase. It would appear that it's been overriden (excluded) in the dependencies. If you continue to have issues, open a new ticket. Your issue is unrelated to this ticket.

@achheman
Copy link

Thanks for the response @mikereiche , that was the issue

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