I got one column family in which I am using composite key. One of my composite key is UUID and the other key is string in which I am passing NULL value. Earlier, I was using hector-0.8.0 and my code was working fine. But now I want to upgrade my hector api to the latest version and its not accepting NULL value.
try {
Composite key = new Composite();
key.addComponent("key1", strSerializer);
key.addComponent(null, strSerializer);
compMutator.addInsertion(key, "columnfamily", HFactory.createColumn("column1", "col2 value",HFactory.createClock(), strSerializer,strSerializer));
compMutator.execute();
} catch (HectorException e) {
e.printStackTrace();
}
Above is the code which is working fine with hector-0.8.2 but giving error when I am using hector-1.1.4
Exception in thread "main" java.lang.NullPointerException: Unable able to add null component at me.prettyprint.hector.api.beans.AbstractComposite.addComponent(AbstractComposite.java:459) at me.prettyprint.hector.api.beans.AbstractComposite.addComponent(AbstractComposite.java:447) at me.prettyprint.hector.api.beans.AbstractComposite.addComponent(AbstractComposite.java:438) at me.prettyprint.hector.api.beans.AbstractComposite.addComponent(AbstractComposite.java:429) at com.impetus.cassandra.hectorClient.Test.main(Test.java:29)
Can anyone help me out with this.
Any help will be appreciated.
Thanx in advance.
Salman
composite key never be null,but if you want composite key null then try this,
try {
Composite key = new Composite();
key.addComponent("key1", strSerializer);
key.addComponent("null", strSerializer);
compMutator.addInsertion(key, "columnfamily", HFactory.createColumn("column1", "col2 value",HFactory.createClock(), strSerializer,strSerializer));
compMutator.execute();
} catch (HectorException e) {
e.printStackTrace();
}
but it is a bad practice