Hi,
I have a POJO that I am caching written like:
public class Person implements Serializable {
private static final long serialVersionUID = 1537032807962869676L;
@QuerySqlField(index = true)
private final Long personId;
@QuerySqlField
private final String firstName;
...
}
This is working well and good, but now I want to add a new field: "homeState":
public class Person implements Serializable {
private static final long serialVersionUID = 1537032807962869676L;
@QuerySqlField(index = true)
private final Long personId;
@QuerySqlField
private final String firstName;
@QuerySqlField(index = true)
private final String homeState;
...
}
If I update the entries in the cache to have the new "homeState" value and then
dump out the contents of the cache, the data is as I would expect. However,
when I try to run a query against the new column (for example: "DELETE FROM
person WHERE homeState = 'CA'") I get the error:
org.h2.jdbc.JdbcSQLException: Column "HOMESTATE" not found; SQL statement:
DELETE FROM person WHERE homeState = ? [42122-195]
My CacheConfiguration used to get the cache:
CacheConfiguration cfg = new CacheConfiguration<>();
cfg.setName("person");
cfg.setIndexedTypes(Long.class, Person.class);
If I print out the QueryEntity objects, it looks like everything is good:
[QueryEntity [keyType=java.lang.Long, valType=com.calabrio.igtest.Person,
keyFieldName=null, valueFieldName=null, fields={personId=java.lang.Long,
firstName=java.lang.String, homeState=java.lang.String}, keyFields=[],
aliases={firstName=firstName, personId=personId, homeState=homeState},
idxs=[QueryIndex [name=Person_personId_idx, fields={personId=true},
type=SORTED, inlineSize=-1], QueryIndex [name=Person_homeState_idx,
fields={homeState=true}, type=SORTED, inlineSize=-1]], tableName=null]]
When I call the metadata REST API, the new field is not listed in the "fields"
section for my cache object.
I've tried this on v2.1 and v2.3. Am I missing something, or is this simply not
possible without including the relevant ALTER TABLE ... statement too? The goal
is to not need to restart the Ignite server cluster.
Thanks
-Tim