public int deleteByAssocIds(AssociateTable table, List<Long> ids) { Map<String, Object> map = new HashMap<String, Object>(); map.put("table", table.getTableName()); map.put("assocCol", table.getAssocCol()); map.put("ids", ids); return this.getSession().delete(NAMESPACE + DELETE_IDS_SQL, map); }
public int deleteByAssoc(AssociateTable table, Long id) { String clause = table.getAssocCol() + "=" + id; Map<String, String> map = new HashMap<String, String>(); map.put("table", table.getTableName()); map.put("clause", clause); return this.getSession().delete(NAMESPACE + DELETE_SQL, map); }
public int deleteByAssocString(AssociateTable table, String str) { String clause = table.getInverseCol() + "='" + str + "'"; Map<String, String> map = new HashMap<String, String>(); map.put("table", table.getTableName()); map.put("clause", clause); return this.getSession().delete(NAMESPACE + DELETE_SQL, map); }
public List<?> selectListByAssoc(AssociateTable table, Long id) { String cols = table.getAssocCol() + " as assocCol," + table.getInverseCol() + " as inverseCol"; String clause = table.getAssocCol() + "=" + id; Map<String, String> map = new HashMap<String, String>(); map.put("table", table.getTableName()); map.put("cols", cols); map.put("clause", clause); return this.getSession().selectList(NAMESPACE + SELECT_SQL, map); }
public void batchInsertByString(AssociateTable table, Long assocCol, List<String> inverseCols) { String insertField = table.getAssocCol() + "," + table.getInverseCol(); for (String str : inverseCols) { Map<String, Object> map = new HashMap<String, Object>(); map.put("table", table.getTableName()); map.put("insertField", insertField); map.put("assocCol", assocCol); map.put("inverseCol", str); this.getSession().insert(NAMESPACE + INSERT_SQL, map); } }