public void put ( Set < HBeanRow > rows ) { final List < Row > create = new ArrayList <> ( ) ; try { for ( HBeanRow row : rows ) { final Put write = new Put ( row . getRowKey ( ) ) ; if ( row . getPropertiesKeyValue ( ) != null ) { write . add ( row . getPropertiesKeyValue ( ) ) ; } for ( KeyValue kv : row . getPredecessors ( ) ) { write . add ( kv ) ; } for ( KeyValue kv : row . getReferencesKeyValue ( ) . values ( ) ) { write . add ( kv ) ; } KeyValue hBean = row . getHBeanKeyValue ( ) ; write . add ( hBean ) ; if ( row . isSingleton ( ) ) { write . add ( new KeyValue ( row . getRowKey ( ) , HBeanRow . SINGLETON_COLUMN_FAMILY , HBeanRow . SINGLETON_COLUMN_FAMILY , new byte [ ] { 1 } ) ) ; } // hbase cannot have rowkeys without columns so we need // a dummy value to represent beans without any values write . add ( new KeyValue ( row . getRowKey ( ) , HBeanRow . DUMMY_COLUMN_FAMILY , HBeanRow . DUMMY_COLUMN_FAMILY , new byte [ ] { 1 } ) ) ; create . add ( write ) ; } table . batch ( create ) ; table . flushCommits ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Put a set of rows .