You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Dmitry Karachentsev <dk...@gridgain.com> on 2017/01/02 06:58:13 UTC

Re: Error in JDBC store

Opened a ticket for that [1].

[1] https://issues.apache.org/jira/browse/IGNITE-4515

On 29.12.2016 23:07, Valentin Kulichenko wrote:
> Hi Dmitry,
>
> My opinion is that this is not a valid case and we should throw an
> exception on cache startup if two Java fields are mapped to the same DB
> field. Even if user needs such duplication on objects level (which I also
> doubt, BTW), the mapping in the store must be correct.
>
> -Val
>
> On Thu, Dec 29, 2016 at 12:23 AM, Dmitriy Karachentsev <
> dkarachentsev@gridgain.com> wrote:
>
>> Hi all!
>>
>> According to this thread [1] in JDBC store configuration:
>> 1. Map key and value fields to the same columns in DB.
>> 2. Try to update data.
>> 3. Got invalid SQL.
>>
>> Let's see an pseudocode example of described use case.
>> KeyClass { field1; field2; field3 }, ValClass { field1; field2; field3 }
>>
>> Map fields to DB table TABLE_NAME columns: field1 -> col1, field2 -> col2,
>> field3 -> col3.
>>
>> User expects the following update request built by Ignite:
>> UPDATE TABLE_NAME SET col1=?, col2=?, col3=? WHERE (col1=?, col2=?,
>> col3=?);
>>
>> But Ignite checks that value object fields have the same mappings, throws
>> them away and builds wrong query:
>> UPDATE TABLE_NAME SET WHERE (col1=?, col2=?, col3=?);
>> That is obviously wrong.
>>
>> Is there any reason to do so?
>> Probably, it is better to build query according to user mapping and
>> delegate verification to DB.
>>
>> [1]
>> http://apache-ignite-users.70518.x6.nabble.com/Error-
>> while-writethrough-operation-in-Ignite-td9696.html
>>
>> Thanks!
>> Dmitry.
>>