I have an empty cache configured with readthrough connected to MySql. can I use SqlFieldsQuery without explicitly call cache.LoadCache? Can I populate the cache using cache.put instead of populating it using cache.LoadCache and still get results using SqlFieldsQuery? Looking into the cache I can see the elements inserted but cursor returns empty (when using cache.LoadCache SqlFieldsQuery /cursor works and returns results for the same exact query)
Asked
Active
Viewed 63 times
1 Answers
1
can I use SqlFieldsQuery without explicitly call cache.LoadCache
No, SQL queries can not perform read-through, only individual key-based operations can (cache.Get
).
Can I populate the cache using cache.put instead of populating it using cache.LoadCache and still get results using SqlFieldsQuery?
Yes.

Pavel Tupitsyn
- 8,393
- 3
- 22
- 44
-
@ptupitsyn (@Pavel Tupitsyn) "Can I populate the cache using cache.put instead of populating it using cache.LoadCache and still get results using SqlFieldsQuery?" - you answered YES... but how? Im currently using cache.put and get empty result when trying to query using SqlFieldsQuery – ofer.ignite Mar 15 '22 at 12:07
-
@ofer.ignite please check this example https://github.com/apache/ignite/blob/master/modules/platforms/dotnet/examples/Thick/Sql/Sql/Program.cs – Pavel Tupitsyn Mar 15 '22 at 17:08
-
@ptupitsyn (@Pavel Tupitsyn) thx for your answer. I went over the code sample and noticed 2 differences from my implementation: 1. Im using setReadThrough(true) and setWriteThrough(false) 2. QueryEntity(typeof(int), typeof(Employee)) - Im inserting into cache class that derive from Employee (in my case kind of EmployeeMock which inherit Employee), while cache object and QueryEntity are set to "Employee". because I use it as part of jUnit – ofer.ignite Mar 23 '22 at 07:06