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

Ask Your Question

SQLQuery without template

Hello all,

we have a GigaSpaces 9.1 SQLQuery that uses a POJO template to match data:

new SqlQuery<T>(pojoTemplate, queryString)

But this constructor is not available anymore in Gigaspaces 11.0.

What is the equivalent code in GigaSpaces 11.0 ?

Thanks in advance. :)

asked 2017-09-26 08:29:09 -0500

Pragmateek's avatar
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

I understand your use case. Unfortunately we don't have other suggestions. b.t.w - we recommend moving to 12.2 which is our last version.

answered 2017-10-01 06:54:31 -0500

Yuval's avatar
edit flag offensive delete link more


Too bad. I've developped a workaround with a basic dynamic mapper between a template object and a query. I'm testing it on the new infrastructure, and I hope all will be OK. :)

Pragmateek's avatar Pragmateek  ( 2017-10-04 10:10:37 -0500 )edit


Please find here examples for 11 version: https://docs.gigaspaces.com/xap/11.0/...

answered 2017-09-27 02:35:34 -0500

Yuval's avatar
edit flag offensive delete link more


Hello Yuval, :-)

thanks for your answer but I don't see the equivalent of the older constructor. Moreover it is written that:

In previous options, parameters could be passed via a POJO template as well. This option is still available, but is deprecated and will be removed in future versions.

But I don't understand how, I only see a dedicated API for exact template matching : Template Matching

AFAIK the older constructor was mixing the two behaviors: the template was used to set the query parameters values instead of using setParameters.

So I wonder if we still could benefit from some automatic mapping between query parameters and their values with the new API?


Pragmateek's avatar Pragmateek  ( 2017-09-27 04:20:53 -0500 )edit

Hi, Unfortunately we forgot to remove this statement. We will remove it. We marked this constructor as deprecated in 8.0 version and remove it in 10 or 11 version. In case you still want to work with templates, you should use the dedicated api as you indicated. In case you want to use sql query please use: SQLQuery(Class, String) 0r SQLQuery(String, String) What is your query? Do you see a problem using the new api? Thanks.

Yuval's avatar Yuval  ( 2017-09-27 06:50:37 -0500 )edit

Thanks. Yes but if I understand well:

  • with the new query API we can use any operator and combination (AND or OR) but we can't specify parameters values with a template object,

  • with the template API we can use only equality matching with AND combination.

Whereas with the older query API we had the best of both worlds : we could use free queries with template objects.

Is it still possible to benefit from both these features at the same time?

Thanks. :)

Pragmateek's avatar Pragmateek  ( 2017-09-27 11:49:21 -0500 )edit


Using template and query together seems the best solution in old versions but then we have changed the code and separated between them. We removed it in a very formal procedure (first we made it deprecated and then removed it). I understand that you are trying not to change your code but the product continue you grow (we are releasing 12.2 version this week). Do you have a specific query that you can't implement using the existing api?



Yuval's avatar Yuval  ( 2017-09-28 03:01:08 -0500 )edit

Hi Yuval,

indeed I'd like to avoid changing the code as it is not trivial. The issue is that we have a component, kind of a GS wrapper, that abstracts it, used by other components we can't change ; and it allows them to pass templates along with queries.

I can imagine some workarounds like manually mapping the templates to call to SetParameter using some reflection, but this is a dedicated development and is error-prone.

We are upgrading because we are forced to as the infrastructure will migrate to GS 11.0, so we are looking for the shortest and simplest path. :)


Pragmateek's avatar Pragmateek  ( 2017-09-28 07:18:11 -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: 2017-09-26 08:29:09 -0500

Seen: 1,410 times

Last updated: Oct 01 '17