Hi,Running the code below doesn't work properly unless I change the field
names from using to '.' (dots) to use '_' (underscores).
Questions:
1. What are the restrictions around field names? In other words, are there
other characters that i can't use?
2. Is there a way to work around this and use dots in the field names?
thanks!
Ignite ignite = Ignition.start(); String id = "id";
String name = "name"; String orgId = "org.id"; String orgName
= "org.name"; String orgOwner = "org.owner";
CacheConfiguration<Object, BinaryObject> cfg = new CacheConfiguration<>();
cfg.setName("deployment"); LinkedHashMap<String, String> fields = new
LinkedHashMap<>(); fields.put("id", "java.lang.String");
fields.put("name", "java.lang.String"); fields.put("org.id",
"java.lang.String"); fields.put("org.name", "java.lang.String");
fields.put("org.owner", "java.lang.String"); QueryEntity queryEntity
= new QueryEntity(); queryEntity.setKeyType("java.lang.String");
queryEntity.setValueType("deployment");
queryEntity.setFields(fields);
cfg.setQueryEntities(Collections.singleton(queryEntity));
IgniteCache<Object, BinaryObject> deployment =
ignite.getOrCreateCache(cfg).withKeepBinary(); BinaryObject
binaryObject = ignite.binary().builder("deployment")
.setField("id", id) .setField("name", name)
.setField("org.id", orgId) .setField("org.name", orgName)
.setField("org.owner", orgOwner) .build();
deployment.put(id, binaryObject); Object o = deployment.get("id");
System.err.println("cache -> " + o); FieldsQueryCursor<List<?>>
query = deployment.query(new SqlFieldsQuery("select * from deployment"));
System.err.println(query.getAll());
output:
cache -> deployment [idHash=1984294974, hash=1137170470, id=id, name=name,
org.id=org.id, org.name=org.name, org.owner=org.owner][[null, null, null]]
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/