private void saveObj(Keyspace keyspace, Mutator<byte[]> m, Object obj) { if (null == obj) { throw new IllegalArgumentException("object cannot be null"); } @SuppressWarnings("unchecked") CFMappingDef<Object> cfMapDef = (CFMappingDef<Object>) cacheMgr.getCfMapDef(obj.getClass(), true); byte[] colFamKey = generateColumnFamilyKeyFromPojo(obj, cfMapDef); String colFamName = cfMapDef.getEffectiveColFamName(); // if object contains collection, then must delete everything first - easier // than reading the row and selectively deleting, which is an alternative if // this is too destructive if (cfMapDef.isAnyCollections()) { m.addDeletion(colFamKey, colFamName); } // must create the "add" columns after the delete to insure proper // processing order Collection<HColumn<String, byte[]>> colColl = createColumnSet(obj); for (HColumn<String, byte[]> col : colColl) { if (null == col.getName() || col.getName().isEmpty()) { throw new HectorObjectMapperException( "Column name cannot be null or empty - trying to persist to ColumnFamily, " + colFamName); } m.addInsertion(colFamKey, colFamName, col); } }