We have to add indexes on cache dynamically on java pojo with nested objects.
In the below example we do not have @QuerySqlField. In this case if I try to
add index on "username" dynamically using "CREATE INDEX" it worked. But if I
want to add index on "Address.zipcode" - this is not working as we are NOT
creating aliases for these fields which are getting added dynamically. I see
there is a bug in this implementation. I fixed the bug (please see below)
and rebuilt the jar in my local and it worked fine. Proposing this bug to
this open source community so that it can be fixed in ignite and we can
start using the jar from central repo. We have just started using ignite and
planning to take this to production. So it would be helpful if we can
implement this bug fix.
User{
String userName;
Address address;
}
Address{
String streetName;
String zipcode;
}
Bug Fix: QueryUtils.class
------------------------------
Method name :
------------------
QueryBinaryProperty buildBinaryProperty(GridKernalContext ctx, String
pathStr,
Class<?> resType, Map<String, String> aliases, @Nullable Boolean
isKeyField, boolean notNull, Object dlftVal,
int precision, int scale)
--------
Change from :
-----------------
String alias = (String)aliases.get(fullName.toString());
to :
-----
String alias = aliases.get(fullName.toString()) == null ?
fullName.toString() : aliases.get(fullName.toString());
With this way we will always make sure we have default alias (if not
provided), otherwise aliases on dynamic query fields and dynamic indexes are
not working properly
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/