Farid-
The SD[G] Repository infrastructure and extension for Pivotal GemFire, and in particular, the explicit OQL query using the @Query
annotation, was never meant to be used in this way.
Essentially, you are attempting to use the SD Repository infrastructure to run "ad hoc" GemFire OQL queries, therefore, why not use the GemfireTemplate directly, or even GemFire's QueryService API for this purpose?
What you are attempting to do is akin to using Hibernate for complex queries beyond mapping and ordinary queries (which is not really the purpose of Hibernate) when JDBC directly (or Spring's JdbcTemplate
) is more appropriate for advance querying capabilities.
It is still possible to use a hybrid approach though, where the "provided" SD Repository infrastructure handles the majority of your application's data access patterns (e.g. CRUD, simple queries, etc) and you combine that with a "custom" Repository implementation.
I have an example of such a "custom" Repository implementation for GemFire in my Contacts Application RI for SDG, here. The CustomerRepository extends CustomerRepositoryExtension, which is implemented in the CustomerRepositoryImpl class. SD's Repository infrastructure picks up this "custom" implementation when creating the Repository proxy for the CustomerRepository interface. In this case, I am having the "custom Repository data access/query method call a GemFire Function (as can be seen here).
In your case, it is a simple matter to run the passed in, dynamic OQL query using the SDG GemfireTemplate
or GemFire's QueryService
API directly.
Hope this helps!
-John