以参数object的主键值作为更新条件,更新所有的属性。
需要注意的是因为要更新所有的属性,所以用户在使用此方法前应该先调用get(Object object)方法。然后再将新的数据设置到从数据库中得到的object中,然后再执行update(Object object)方法
4647484950515253545556
public void update(Object o) throws EasyJException { Session session = null; try { session = SessionFactory.openSession(); session.update(o); } finally { if (session != null) session.close(); }
118119120121122123124125126127128
clazz, easyJ.common.Const.PRIMARY_KEY); Filter filter = DAOFactory.getFilter(primaryKey, SQLOperator.EQUAL, primaryKeys[i]); ucmd.setFilter(filter); // EasyJLog.debug(ucmd.getExecutableSQL()); session.update(ucmd); } } finally { if (session != null) session.close(); }
5960616263646566676869
public void update(Object o) throws easyJ.common.EasyJException { Session session = null; try { session = SessionFactory.openSession(); Class clazz = o.getClass(); session.update(o); String[] subClassProperties = BeanUtil.getSubClassProperties(clazz); for (int i = 0; i < subClassProperties.length; i++) { String property = subClassProperties[i]; ArrayList propertyValues = (ArrayList) BeanUtil.getFieldValue( o, property);
6970717273747576777879
o, property); for (int j = 0; j < propertyValues.size(); j++) { Object primaryKeyValue = BeanUtil .getPrimaryKeyValue(propertyValues.get(j)); if (primaryKeyValue != null) session.update(propertyValues.get(j)); else session.create(propertyValues.get(j)); } } } finally {