public void delete(Class<?> entityType, WhereBuilder whereBuilder) throws DbException { if (!tableIsExist(entityType)) return; try { beginTransaction(); execNonQuery(SqlInfoBuilder.buildDeleteSqlInfo(this, entityType, whereBuilder)); setTransactionSuccessful(); } finally { endTransaction(); } }
public void update(Object entity, String... updateColumnNames) throws DbException { if (!tableIsExist(entity.getClass())) return; try { beginTransaction(); execNonQuery(SqlInfoBuilder.buildUpdateSqlInfo(this, entity, updateColumnNames)); setTransactionSuccessful(); } finally { endTransaction(); } }
public void save(Object entity) throws DbException { try { beginTransaction(); createTableIfNotExist(entity.getClass()); execNonQuery(SqlInfoBuilder.buildInsertSqlInfo(this, entity)); setTransactionSuccessful(); } finally { endTransaction(); } }
public void delete(Object entity) throws DbException { if (!tableIsExist(entity.getClass())) return; try { beginTransaction(); execNonQuery(SqlInfoBuilder.buildDeleteSqlInfo(this, entity)); setTransactionSuccessful(); } finally { endTransaction(); } }
public void saveOrUpdate(Object entity) throws DbException { try { beginTransaction(); createTableIfNotExist(entity.getClass()); saveOrUpdateWithoutTransaction(entity); setTransactionSuccessful(); } finally { endTransaction(); } }
public boolean saveBindingId(Object entity) throws DbException { boolean result = false; try { beginTransaction(); createTableIfNotExist(entity.getClass()); result = saveBindingIdWithoutTransaction(entity); setTransactionSuccessful(); } finally { endTransaction(); } return result; }
public void updateAll(List<?> entities, String... updateColumnNames) throws DbException { if (entities == null || entities.size() == 0 || !tableIsExist(entities.get(0).getClass())) return; try { beginTransaction(); for (Object entity : entities) { execNonQuery(SqlInfoBuilder.buildUpdateSqlInfo(this, entity, updateColumnNames)); } setTransactionSuccessful(); } finally { endTransaction(); } }
public void saveAll(List<?> entities) throws DbException { if (entities == null || entities.size() == 0) return; try { beginTransaction(); createTableIfNotExist(entities.get(0).getClass()); for (Object entity : entities) { execNonQuery(SqlInfoBuilder.buildInsertSqlInfo(this, entity)); } setTransactionSuccessful(); } finally { endTransaction(); } }
public void saveOrUpdateAll(List<?> entities) throws DbException { if (entities == null || entities.size() == 0) return; try { beginTransaction(); createTableIfNotExist(entities.get(0).getClass()); for (Object entity : entities) { saveOrUpdateWithoutTransaction(entity); } setTransactionSuccessful(); } finally { endTransaction(); } }
public void saveBindingIdAll(List<?> entities) throws DbException { if (entities == null || entities.size() == 0) return; try { beginTransaction(); createTableIfNotExist(entities.get(0).getClass()); for (Object entity : entities) { if (!saveBindingIdWithoutTransaction(entity)) { throw new DbException("saveBindingId error, transaction will not commit!"); } } setTransactionSuccessful(); } finally { endTransaction(); } }