MySQL Forums
Forum List  »  Connector/Node.js

xDev API Java example for using an Array in where clause
Posted by: Subramanyam Vummethala
Date: March 15, 2022 07:41AM

xDev API Java example for using an Array in where clause.
We are using Java Spring boot connecting to MySQL xDev API.
In NOSQL document, one of the attribute is a JSON Array.
From Java code, we are trying to fetch the data matching to one of the element in the array. For this we are using "in" operator.
Can someone help us with the syntax of this query in Java language.

.find("(Role like: ABC "
+ "Role2 IN : role2)"
+ "AND active like : isActive")
.bind(ABC, ABC)
.bind("role2", ["PQR"])
.bind("isActive", TRUE)
.execute();
Here I am trying with a binding parameter role2 for matching my input value PQR with any of the elements in that array (eg ;"PQR","XYZ", "MNO", "EFG"].
My expectation is to fetch data matching with below criteria:
(Role = ABC or Role2 = PQR ) AND isActive = TRUE
Please note the using OR above.

Options: ReplyQuote


Subject
Written By
Posted
xDev API Java example for using an Array in where clause
March 15, 2022 07:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.