org.hibernate.classic.Session.update()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(243)

本文整理了Java中org.hibernate.classic.Session.update()方法的一些代码示例,展示了Session.update()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Session.update()方法的具体详情如下:
包路径:org.hibernate.classic.Session
类名称:Session
方法名:update

Session.update介绍

[英]Update the persistent state associated with the given identifier. An exception is thrown if there is a persistent instance with the same identifier in the current session. This operation cascades to associated instances if the association is mapped with cascade="save-update".
[中]

代码示例

代码示例来源:origin: org.motechproject/motech-server-core

public void update(Object obj) {
  sessionFactory.getCurrentSession().update(obj);
}

代码示例来源:origin: org.n52.sensorweb/52n-sps-hibernate

public void updateInstance(SensorTask instance) {
  LOGGER.debug("updateInstance({})", instance);
  getCurrentSession().update(instance);
}

代码示例来源:origin: org.n52.sensorweb/52n-sps-hibernate

public void updateInstance(SensorConfiguration instance) {
  LOGGER.debug("updateInstance({})", instance);
  getCurrentSession().update(instance);
}

代码示例来源:origin: com.lohika.alp/alp-reporter

/**
 * Update Hibernate persistent object.
 *
 * @param object to update
 */
protected void updateObject(Object obj) {
  Session session = factory.openSession();
  Transaction tx = null;
  try {
    tx = session.beginTransaction();
    session.update(obj);
    tx.commit();
  } catch (Exception e) {
    if (tx != null)
      tx.rollback();
  } finally {
    session.close();
  }
}

代码示例来源:origin: jtalks-org/jcommune

/**
 * {@inheritDoc}
 */
@Override
public void delete(Group group) {
  session().update(group);
  group.getUsers().clear();
  saveOrUpdate(group);
  super.delete(group);
}

代码示例来源:origin: org.geomajas/geomajas-project-deskmanager

public void deleteLayerModel(LayerModel lm) throws GeomajasSecurityException, HibernateException {
  if (((DeskmanagerSecurityContext) securityContext).deleteAllowed(lm)) {
    if (!isLayerModelInUse(lm.getClientLayerId())) {
      lm.setDeleted(true);
      factory.getCurrentSession().update(lm);
    } else {
      throw new HibernateException("Layermodel is still in use.");
    }
  } else {
    throw new GeomajasSecurityException(ExceptionCode.COMMAND_ACCESS_DENIED, "Remove layermodel",
        securityContext.getUserName());
  }
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-deskmanager

public void deleteLayerModel(LayerModel lm) throws GeomajasSecurityException, HibernateException {
  if (((DeskmanagerSecurityContext) securityContext).deleteAllowed(lm)) {
    if (!isLayerModelInUse(lm.getClientLayerId())) {
      lm.setDeleted(true);
      factory.getCurrentSession().update(lm);
    } else {
      throw new HibernateException("Layermodel is still in use.");
    }
  } else {
    throw new GeomajasSecurityException(ExceptionCode.COMMAND_ACCESS_DENIED, "Remove layermodel",
        securityContext.getUserName());
  }
}

代码示例来源:origin: net.sf.taverna.t2/t2reference-impl

sessionFactory.getCurrentSession().update(rs);
} catch (Exception ex) {
  throw new DaoException(ex);

代码示例来源:origin: net.sf.taverna.t2.core/reference-impl

sessionFactory.getCurrentSession().update(rs);
} catch (Exception ex) {
  throw new DaoException(ex);

代码示例来源:origin: net.sf.taverna.t2/reference-impl

sessionFactory.getCurrentSession().update(rs);
} catch (Exception ex) {
  throw new DaoException(ex);

相关文章