@Override public void remove(MemberAttribute memberAttribute) { if ((memberAttribute != null) && ((memberAttribute.getType() == MemberAttribute.Type.text) || (memberAttribute.getType() == MemberAttribute.Type.select) || (memberAttribute.getType() == MemberAttribute.Type.checkbox))) { String str1 = "attributeValue" + memberAttribute.getPropertyIndex(); String str2 = "update Member members set members." + str1 + " is null"; this.getEntityManager().createQuery(str2).setFlushMode(FlushModeType.COMMIT).executeUpdate(); super.remove(memberAttribute); } }
@Override public void delete(ProductCategory productCategory) { if (productCategory != null) { StringBuffer localStringBuffer = new StringBuffer("update Product product set "); for (int i = 0; i < 20; i++) { String str = "attributeValue" + i; if (i == 0) localStringBuffer.append("product." + str + " = null"); else localStringBuffer.append(", product." + str + " = null"); } localStringBuffer.append(" where product.productCategory = :productCategory"); this.getEntityManager() .createQuery(localStringBuffer.toString()) .setFlushMode(FlushModeType.COMMIT) .setParameter("productCategory", productCategory) .executeUpdate(); super.remove(productCategory); } }
@Override public void persist(ProductCategory productCategory) { setProductCategoryOfTreepathAndGrade(productCategory); super.persist(productCategory); }