Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

SQLQuery: Not Returning Expected Result

Hi All,

We currently store objects in gigaspace in the following format

Unique ID (java.lang.String) Number (java.lang.Long) 1 12345678 2 1000 3 56

When I ran the query (this can be proven even on the admin ui), Number < 700, it should return only row 3 but unfortunately it returned all 3 records. What should be the construction of the query in order to only return row 3

Regards, Donnie

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=3820]{quote}

asked 2012-02-08 20:49:44 -0500

marse91782's avatar

updated 2013-08-08 09:52:00 -0500

jaissefsfex's avatar
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

Can you please post your test code?
Something is wrong with the way you query the data or with the way you construct and store the data.

answered 2012-02-08 21:51:12 -0500

shay hassidim's avatar
edit flag offensive delete link more


String sqlQuery = "Number < ?";
List parms = new ArrayList();

SQLQuery sqlQuery = new SQLQuery(Pojo.class, sqlQuery);

Object result = space.readMultiple(sqlQuery, Integer.MAX_VALUE);

marse91782's avatar marse91782  ( 2012-02-08 22:12:59 -0500 )edit


Can you please post your Pojo class source code as well?

"number" is a reserved word in our SQL parser so in your case you should expect a ReadMultipleException with an SQLQueryException as its cause.

If you follow java's naming convention your pojo should look like:

public class MyClass {
        private String uniqueId;
private Long numberValue;

public MyClass() {

        public String getUniqueId() {
            return uniqueId;
        public void setUniqueId(String uniqueId) {
            this.uniqueId = uniqueId;
        public Long getNumberValue() {
            return numberValue;
        public void setNumberValue(Long number) {
            this.numberValue = number;

And query:
SQLQuery query = new SQLQuery(MyClass.class, "numberValue < ?");

idan's avatar idan  ( 2012-02-09 03:31:16 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-02-08 20:49:44 -0500

Seen: 73 times

Last updated: Feb 08 '12