@Override public void updateGroup(String user, GroupDescriptor group) throws ZeusException { GroupPersistence old = (GroupPersistence) getHibernateTemplate().get(GroupPersistence.class, Integer.valueOf(group.getId())); updateGroup( user, group, old.getOwner(), old.getParent() == null ? null : old.getParent().toString()); }
public void updateGroup(String user, GroupDescriptor group, String owner, String parent) throws ZeusException { GroupPersistence old = (GroupPersistence) getHibernateTemplate().get(GroupPersistence.class, Integer.valueOf(group.getId())); GroupPersistence persist = PersistenceAndBeanConvert.convert(group); persist.setOwner(owner); if (parent != null) { persist.setParent(Integer.valueOf(parent)); } // 以下属性不允许修改,强制采用老的数据 persist.setDirectory(old.getDirectory()); persist.setGmtCreate(old.getGmtCreate()); persist.setGmtModified(new Date()); getHibernateTemplate().update(persist); }