title: Saving multiple versions in HBase cell
body: <p>I am new to HBase. I am trying to save multiple versions in a cell in HBase but I am just getting the last saved value only. I tried the following two commands to retrieve multiple saved versions:
  <code>get 'Dummy1','abc', {COLUMN=&gt;'backward:first', VERSIONS=&gt;12}</code> and <code>scan 'Dummy1', {VERSIONS=&gt;12}</code>
  Both returned the output as follows:</p>
  
  <pre><code>ROW                   COLUMN+CELL                                               
   abc                  column=backward:first, timestamp=1422722312845, value=rrb 
  </code></pre>
  
  <p>1 row(s) in 0.0150 seconds
  The input file is as follows:</p>
  
  <pre><code>abc xyz kkk
  abc qwe asd
  abc anf rrb
  </code></pre>
  
  <p>The code for Table creation in HBase is as follows:</p>
  
  <pre><code>import org.apache.hadoop.hbase.HBaseConfiguration;
  import org.apache.hadoop.hbase.HColumnDescriptor;
  import org.apache.hadoop.hbase.HTableDescriptor;
  import org.apache.hadoop.hbase.client.HBaseAdmin;
  
  public class HBaseTableCreator {
  
    public static void main(String[] args) throws Exception {
  
        HBaseConfiguration conf = new HBaseConfiguration();
        conf.set("hbase.master","localhost:60000");
  
        HBaseAdmin hbase = new HBaseAdmin(conf);
        HTableDescriptor desc = new HTableDescriptor("Dummy");
        HColumnDescriptor meta = new HColumnDescriptor("backward".getBytes());
        meta.setMaxVersions(Integer.MAX_VALUE);
        HColumnDescriptor prefix = new HColumnDescriptor("forward".getBytes());
        prefix.setMaxVersions(Integer.MAX_VALUE);
        desc.addFamily(meta);
        desc.addFamily(prefix);
        hbase.createTable(desc);
  
   }
  
  }
  </code></pre>
  
  <p>The code to Dump the data in HBase is as follows:
  Main Class:
      import java.io.IOException;</p>
  
  <pre><code>import org.apache.hadoop.conf.Configuration;
  import org.apache.hadoop.fs.Path;
  import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil;
  import org.apache.hadoop.mapreduce.Job;
  import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
  import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
  import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
  import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
  import org.apache.hadoop.util.GenericOptionsParser;
  
  
  public class TestMain {
      public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException 
      {
          // TODO Auto-generated method stub
          Configuration conf=new Configuration();
          //HTable hTable = new HTable(conf, args[3]);  
          String[] otherArgs=new GenericOptionsParser(conf,args).getRemainingArgs();
          if(otherArgs.length!=2)
          {
              System.err.println("Usage: wordcount &lt;in&gt; &lt;out&gt;");
              System.exit(2);
          }
          Job job=new Job(conf,"HBase dummy dump");
          job.setJarByClass(TestMain.class);
          job.setInputFormatClass(TextInputFormat.class);
          job.setOutputFormatClass(TextOutputFormat.class); 
          job.setMapperClass(TestMapper.class);
          TableMapReduceUtil.initTableReducerJob("Dummy", null, job);
          //job.setOutputKeyClass(NullWritable.class);
          //job.setOutputValueClass(Text.class);
          job.setNumReduceTasks(0);
          //job.setOutputKeyClass(Text.class);
          //job.setOutputValueClass(Text.class);
          FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
          FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
          //HFileOutputFormat.configureIncrementalLoad(job, hTable);
          System.exit(job.waitForCompletion(true)?0:1);
      }
  }
  </code></pre>
  
  <p>Mapper Class:</p>
  
  <pre><code>import java.io.IOException;
  
  import org.apache.hadoop.hbase.client.Put;
  import org.apache.hadoop.io.*;
  import org.apache.hadoop.mapreduce.Mapper;
  
  public class TestMapper extends Mapper &lt;LongWritable, Text, Text, Put&gt;{
      public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { 
  
          String line=value.toString();
          String[] l=line.split("\\s+");
          for(int i=1;i&lt;l.length;i++)
          {
              Put HPut = new Put(l[0].getBytes());
              HPut.add("backward".getBytes(),"first".getBytes(),l[i].getBytes());
              context.write(new Text(l[0]),HPut);
          }
      }
  }
  </code></pre>
  
  <p>Please tell me where I'm going wrong.</p>