storm-apt/api/src/main/java/com/turbomanage/storm/SQLiteDao.java
public long insertMany(Iterable<T> many) {
		long numInserted = 0;
		InsertHelper insertHelper = new DatabaseUtils.InsertHelper(getWritableDb(), th.getTableName());
		getWritableDb().beginTransaction();
		try {
			for (T obj : many) {
				ContentValues cv = th.getEditableValues(obj);
				if (th.getId(obj) == 0) {
					// the default, remove from ContentValues to allow autoincrement
					cv.remove(th.getIdCol().toString());
				}
				long id = insertHelper.insert(cv);
				if (id == -1)
					return -1;
				numInserted++;
			}
			getWritableDb().setTransactionSuccessful();
		} finally {
			getWritableDb().endTransaction();
		}
		return numInserted;
	}
public long insertMany(Iterable<T> many) {
		long numInserted = 0;
		InsertHelper insertHelper = new DatabaseUtils.InsertHelper(getWritableDb(), th.getTableName());
		getWritableDb().beginTransaction();
		try {
			for (T obj : many) {
				ContentValues cv = th.getEditableValues(obj);
				if (th.getId(obj) == 0) {
					// the default, remove from ContentValues to allow autoincrement
					cv.remove(th.getIdCol().toString());
				}
				long id = insertHelper.insert(cv);
				if (id == -1)
					return -1;
				numInserted++;
			}
			getWritableDb().setTransactionSuccessful();
		} finally {
			getWritableDb().endTransaction();
		}
		return numInserted;
	}
public long insertMany ( Iterable < T > many ) { long numInserted = 0 ; InsertHelper insertHelper = new DatabaseUtils . InsertHelper ( getWritableDb ( ) , th . getTableName ( ) ) ; getWritableDb ( ) . beginTransaction ( ) ; try { for ( T obj : many ) { ContentValues cv = th . getEditableValues ( obj ) ; if ( th . getId ( obj ) == 0 ) { // the default, remove from ContentValues to allow autoincrement cv . remove ( th . getIdCol ( ) . toString ( ) ) ; } long id = insertHelper . insert ( cv ) ; if ( id == - 1 ) return - 1 ; numInserted ++ ; } getWritableDb ( ) . setTransactionSuccessful ( ) ; } finally { getWritableDb ( ) . endTransaction ( ) ; } return numInserted ; }
Efficiently insert a collection of entities using {@link InsertHelper}.

@param many Collection of objects
@return count of inserted objects or -1 immediately if any errors
Efficiently insert a collection of entities using { @link InsertHelper } .