The Mutator#insert signature is a single insertion operation. To "batch" operations, use Mutator#addInsertion. You must then call Mutator#execute to send the batched operations.
For Hector specific questions, feel free to sign up for hector-us...@googlegroups.com as well. On Mon, May 23, 2011 at 4:47 PM, Jian Fang <jian.fang.subscr...@gmail.com> wrote: > Hi, > > I am pretty new to Cassandra and am going to use Cassandra 0.8.0. I have two > questions (sorry if they are very basic ones): > > 1) I have a column family to hold many super columns, say 30. When I first > insert the data to the column family, do I need to insert each column one at > a time or can I insert the whole column family in one transaction (or > call?)? The latter one seems to be more efficient to me. Does Cassandra > support that? > > For example, I saw the following code to do insertion (with Hector), > > Mutator m = HFactory.createMutator(keyspace, stringSerializer); > //Mutator<String> m = > HFactory.createMutator(keyspace,stringSerializer); > m.insert(p.getCassandraKey(), colFamily, > HFactory.createStringColumn("type", > p.getStringValue())); > m.insert(p.getCassandraKey(), colFamily, > HFactory.createColumn("data", p.getCompressedXML(), > StringSerializer.get(), > BytesArraySerializer.get())); > > Will the insertions be two separate calls to Cassandra? Or they are just one > transaction? If it is the former case, is there any way to make them as one > call to Cassandra? > > 2) How to store a list/array of data in Cassandra? For example, I have a > data field called categories, which include none or many categories and each > category includes a category id and a category description. Usually, how do > people handle this scenario when they use Cassandra? > > Thanks in advance, > > John >