You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by kotamrajuyashasvi <ko...@gmail.com> on 2017/08/30 07:31:30 UTC
updating key object field using ignite sql query
Hi
In my ignite application I am using a cache with an object/POJO as a cache
key. Now how to update the key fields of cache key using ignite sql queries.
When I try to update I am getting 'Failed to parse query' error.
For example my cache stores value in person [fields: id,name,phno] and key
in personpk [fields:id,phno] POJO classes respectively. Now if I execute the
query "update person set _key.id = 1 where id=2" I am getting error. I have
added @QuerySqlField annotations for all fields in person and personpk POJO
classes.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: updating key object field using ignite sql query
Posted by Denis Magda <dm...@apache.org>.
Hi,
Ignite prevents you to update the key or its field. Look for "Inability to modify a key or its fields with an UPDATE query” callout at the bottom of this section to find a reasoning behind this:
https://apacheignite.readme.io/docs/dml#section-update <https://apacheignite.readme.io/docs/dml#section-update>
As a side note, even if this was allowed, instead of “_key.id” you should have used just “id”.
—
Denis
> On Aug 30, 2017, at 12:31 AM, kotamrajuyashasvi <ko...@gmail.com> wrote:
>
> Hi
>
> In my ignite application I am using a cache with an object/POJO as a cache
> key. Now how to update the key fields of cache key using ignite sql queries.
> When I try to update I am getting 'Failed to parse query' error.
>
>
> For example my cache stores value in person [fields: id,name,phno] and key
> in personpk [fields:id,phno] POJO classes respectively. Now if I execute the
> query "update person set _key.id = 1 where id=2" I am getting error. I have
> added @QuerySqlField annotations for all fields in person and personpk POJO
> classes.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/