Hello!
> Fields = new[] { newQueryField("ClassCode", typeof(
string)) { IsKeyField =true }, new QueryField("Priority", typeof(int)) {
IsKeyField = false } }
Here you declare that you have a field ClassCode *in* your composite key,
and Priority *in* your composite value.
But you have neither.
You should use KeyFieldName/ValueFieldName instead (if they present in .Net
API).
Regards,
--
Ilya Kasnacheev
пн, 28 янв. 2019 г. в 15:33, Som Som <[email protected]>:
> .Net part:
>
> using (var ignite =Ignition.StartClient(Ignition
> .ClientConfigurationSectionName))
>
> {
>
> var queryEntity = new QueryEntity
>
> {
>
> KeyTypeName = typeof(string).FullName,
>
> KeyType = typeof(string),
>
> ValueTypeName = typeof(int).FullName,
>
> ValueType = typeof(int),
>
> Fields = new[] { newQueryField("ClassCode", typeof(
> string)) { IsKeyField =true }, new QueryField("Priority", typeof(int)) {
> IsKeyField = false } }
>
> };
>
>
>
> queryEntity.TableName =IgniteCacheName
> .QUIK_CLASSCODE_PRIORITY;
>
>
>
> var cfg = new CacheClientConfiguration(IgniteCacheName
> .QUIK_CLASSCODE_PRIORITY, new[] { queryEntity })
>
> {
>
> DataRegionName = "persistent",
>
> Backups = 1,
>
> SqlSchema = "PUBLIC"
>
> };
>
>
>
> var c = ignite.GetOrCreateCache<string, int>(cfg);
>
>
>
> c.Put("a", 1);
>
> }
>
>
>
> Sql query part:
>
>
>
> This query works ok – SELECT _Key, _Val FROM "QUIK.CLASSCODEPRIORITY"
>
> But this one throws an error mentioned above SELECT SecCode, Prioruty FROM
> "QUIK.CLASSCODEPRIORITY"
>
> пн, 28 янв. 2019 г., 14:23 Ilya Kasnacheev [email protected]:
>
>> Hello!
>>
>> Can you please show your cache configuration and the exact SQL statement
>> used?
>>
>> What happens here is that Ignite expects some composite value type as
>> opposed to bare integer. Not so clear why yet.
>>
>> Regards,
>> --
>> Ilya Kasnacheev
>>
>>
>> пн, 28 янв. 2019 г. в 14:12, Som Som <[email protected]>:
>>
>>>
>>> hi, i'v got a roblem reading the cache throgh the odbc.
>>>
>>> cahche was created in .net, key type is string, value type is int.
>>>
>>> error text:
>>>
>>> SQL Error [50000]: javax.cache.CacheException: Failed to execute map
>>> query on remote node [nodeId=c3ef8d97-09d0-432d-a0a2-7fd73e8413bc,
>>> errMsg=Failed to execute SQL query. General error: "class
>>> org.apache.ignite.IgniteCheckedException: Unexpected binary object class
>>> [type=class java.lang.Integer]"; SQL statement:
>>>
>>> SELECT
>>>
>>> __Z0.CLASSCODE __C0_0,
>>>
>>> __Z0.PRIORITY __C0_1
>>>
>>> FROM PUBLIC."QUIK.CLASSCODEPRIORITY" __Z0 [50000-197]]
>>>
>>> javax.cache.CacheException: Failed to execute map query on remote node
>>> [nodeId=c3ef8d97-09d0-432d-a0a2-7fd73e8413bc, errMsg=Failed to execute SQL
>>> query. General error: "class org.apache.ignite.IgniteCheckedException:
>>> Unexpected binary object class [type=class java.lang.Integer]"; SQL
>>> statement:
>>>
>>> SELECT
>>>
>>> __Z0.CLASSCODE __C0_0,
>>>
>>> __Z0.PRIORITY __C0_1
>>>
>>> FROM PUBLIC."QUIK.CLASSCODEPRIORITY" __Z0 [50000-197]]
>>>
>>> javax.cache.CacheException: Failed to execute map query on remote node
>>> [nodeId=c3ef8d97-09d0-432d-a0a2-7fd73e8413bc, errMsg=Failed to execute SQL
>>> query. General error: "class org.apache.ignite.IgniteCheckedException:
>>> Unexpected binary object class [type=class java.lang.Integer]"; SQL
>>> statement:
>>>
>>> SELECT
>>>
>>> __Z0.CLASSCODE __C0_0,
>>>
>>> __Z0.PRIORITY __C0_1
>>>
>>> FROM PUBLIC."QUIK.CLASSCODEPRIORITY" __Z0 [50000-197]]
>>>
>>