@Override public void delete(String userName, String eventId) { super.delete( Arrays.asList( newEqualQueryParameter("userName", userName), newEqualQueryParameter("eventId", eventId))); }
/** * 带一个参数的删除动作 * * @param sql * @param paramValue * @param paramType * @throws E5Exception */ public static void delete(String sql, Object paramValue, Type paramType) throws E5Exception { try { BaseDAO dao = new BaseDAO(); dao.delete(sql, paramValue, paramType); } catch (HibernateException e) { throw new E5Exception(e); } }
/** * 不带参数的删除动作,外传入Session * * @param sql * @param paramValue * @param paramType * @throws E5Exception */ public static void delete(String sql, Session s) throws E5Exception { try { BaseDAO dao = new BaseDAO(); dao.delete(sql, s); } catch (HibernateException e) { throw new E5Exception(e); } }
/** * 带多个参数的删除动作,传入Session * * <p>从Hibernate2.0升级到Hibernate3.0时本方法被迫改动 <br> * 因为3.0后去掉了带参数(Object[], Type[])的方法,无法直接调用 <br> * 不能使用Query.getNamedParameters来获取参数名称, 因为该方法返回的数组是从Map中得到的,顺序不固定 * * @param query HQL删除语句 * @param paramName HQL语句中的参数名数组 * @param paramValue 参数的值数组 * @param paramType 参数的类型数组 * @param s * @throws E5Exception */ public static void delete( String sql, String[] paramName, Object[] paramValue, Type[] paramType, Session s) throws E5Exception { try { BaseDAO dao = new BaseDAO(); dao.delete(sql, paramName, paramValue, paramType, s); } catch (HibernateException e) { throw new E5Exception(e); } }
/** * Delete a persistent UserProperty entity. This operation must be performed within the a database * transaction context for the entity's data to be permanently deleted from the persistence store, * i.e., database. This method uses the {@link javax.persistence.EntityManager#remove(Object) * EntityManager#delete} operation. * * @param entity UserProperty entity to delete * @throws Exception * @throws RuntimeException when the operation fails */ public void delete(UserProperty entity) throws Exception { log.info("deleting UserProperty instance"); try { entity = getEntityManager().getReference(UserProperty.class, entity.getId()); super.delete(entity); log.info("delete successful"); } catch (RuntimeException e) { log.error("delete failed", e); throw e; } }
public void delete(Newscomment comment) { super.delete(comment); }