Re: UPDATE SQL for nested BinaryObject throws exception.

2017-09-05 Thread afedotov
Hi,

FYI. Created tickets related to the subject:
1) https://issues.apache.org/jira/browse/IGNITE-6265
2) https://issues.apache.org/jira/browse/IGNITE-6266
3) https://issues.apache.org/jira/browse/IGNITE-6268



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: UPDATE SQL for nested BinaryObject throws exception.

2017-09-04 Thread afedotov
Hi,

Actually, flattening the nested properties with aliases works only for one
level as for now.
Looks like it's a bug. I'll file a JIRA ticket for this.

Kind regards,
Alex



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: UPDATE SQL for nested BinaryObject throws exception.

2017-09-03 Thread Dmitriy Setrakyan
Cross sending to dev@

Igniters, up until version 1.9, the nested fields were supported by
flattening the names. Do we still support it? I cannot seem to find
documentation for it.

D.

On Thu, Aug 31, 2017 at 7:12 AM, takumi  wrote:

> This is a part of the real code that I wrote.
>
> -
>   List entities = new ArrayList<>();
>   QueryEntity qe = new QueryEntity(String.class.getName(), "cache");
>   qe.addQueryField("attribute.prop1", Double.class.getName(), "prop3");
>   qe.addQueryField("attribute.prop2", String.class.getName(), "prop4");
>   qe.addQueryField("attribute.prop.prop1", Double.class.getName(),
> "prop5");
>   qe.addQueryField("attribute.prop.prop2", String.class.getName(),
> "prop6");
>
>   BinaryObject bo  =ib.builder("cache").setField("attribute",
> ib.builder("cache.attribute")
>   .setField("prop",
> ib.builder("cache.attribute.prop")
>.setField("prop1", 50.0, Double.class)
>.setField("prop2", "old", String.class))
>   .setField("prop1", 50.0, Double.class)
>   .setField("prop2", "old", String.class)).build();
>
>   cache.put("key1", bo);
>   cache.query(new SqlFieldsQuery("update cache set prop4 = 'new'  where
> prop3 >= 20.0"));//OK
>   cache.query(new SqlFieldsQuery("update cache set prop6 = 'new'  where
> prop5 >= 20.0"));//NG
> -
>
> I can update 'prop4' by SQL, but I do not update 'prop6' by SQL.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>


Re: UPDATE SQL for nested BinaryObject throws exception.

2017-08-31 Thread takumi
This is a part of the real code that I wrote.

-
  List entities = new ArrayList<>();
  QueryEntity qe = new QueryEntity(String.class.getName(), "cache");
  qe.addQueryField("attribute.prop1", Double.class.getName(), "prop3");
  qe.addQueryField("attribute.prop2", String.class.getName(), "prop4");
  qe.addQueryField("attribute.prop.prop1", Double.class.getName(), "prop5");
  qe.addQueryField("attribute.prop.prop2", String.class.getName(), "prop6");

  BinaryObject bo  =ib.builder("cache").setField("attribute",
ib.builder("cache.attribute")
  .setField("prop",
ib.builder("cache.attribute.prop")
   .setField("prop1", 50.0, Double.class)
   .setField("prop2", "old", String.class))
  .setField("prop1", 50.0, Double.class)
  .setField("prop2", "old", String.class)).build();

  cache.put("key1", bo);
  cache.query(new SqlFieldsQuery("update cache set prop4 = 'new'  where
prop3 >= 20.0"));//OK
  cache.query(new SqlFieldsQuery("update cache set prop6 = 'new'  where
prop5 >= 20.0"));//NG
-

I can update 'prop4' by SQL, but I do not update 'prop6' by SQL. 



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: UPDATE SQL for nested BinaryObject throws exception.

2017-08-31 Thread afedotov
Hi,

Currently referencing nested object's fields from SQL isn't supported for
both regular Java objects and for BinaryObject-s.

In other words, having 

class B {
private String field1;
}

class A {
private B bField;
}

you cannot update it like `update A set bField.field1=?`

Kind regards,
Alex.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: UPDATE SQL for nested BinaryObject throws exception.

2017-08-31 Thread Andrey Mashenkov
Does this work for regular objects?


BWT: looks like a type when you set a builder to field instead of binary
object itself "bb.build()"

On Thu, Aug 31, 2017 at 4:32 PM, takumi  wrote:

> I use SqlQuery for nested BinaryObject.
> The BinaryObject instance is following structure.
>
>BinaryObjectBuilder bb2 = binary.builder("nested2
> hoge").setField("field2", "old", String.class);
>BinaryObjectBuilder bb = binary.builder("nested
> hoge").setField("field1",
> bb2);
>binary.builder("hoge").setField("field0", bb);
>
> The sample SQL to throw an exception is "update " + CACHE_NAME + " set
> field2 = 'new'".
>
> The cause to throw an exception to is that I update a field of BinaryObject
> which is child of nested BinaryObject .
> When I update a field of BinaryObject which is nested BinaryObject, it do
> not throw an exception.
>
> Should I not use this SQL for child of nested BinaryObject?
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 
Best regards,
Andrey V. Mashenkov


UPDATE SQL for nested BinaryObject throws exception.

2017-08-31 Thread takumi
I use SqlQuery for nested BinaryObject.
The BinaryObject instance is following structure.

   BinaryObjectBuilder bb2 = binary.builder("nested2
hoge").setField("field2", "old", String.class);
   BinaryObjectBuilder bb = binary.builder("nested hoge").setField("field1",
bb2);
   binary.builder("hoge").setField("field0", bb);

The sample SQL to throw an exception is "update " + CACHE_NAME + " set
field2 = 'new'". 

The cause to throw an exception to is that I update a field of BinaryObject
which is child of nested BinaryObject .
When I update a field of BinaryObject which is nested BinaryObject, it do
not throw an exception.

Should I not use this SQL for child of nested BinaryObject?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/