storm-apt/api/src/main/java/com/turbomanage/storm/SQLiteDao.java
public long save(T obj) {
		if (th.getId(obj) == 0) {
			return insert(obj);
		}
		long updated = update(obj);
		if (updated == 1) {
			return 0;
		}
		return -1;
	}
public long save(T obj) {
		if (th.getId(obj) == 0) {
			return insert(obj);
		}
		long updated = update(obj);
		if (updated == 1) {
			return 0;
		}
		return -1;
	}
Insert or update.

@param obj An entity
@return 0 if updated, -1 if err, else new ID