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

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

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

Session.delete介绍

[英]Delete all objects returned by the query. Return the number of objects deleted.
[中]删除查询返回的所有对象。返回已删除的对象数。

代码示例

代码示例来源:origin: gocd/gocd

@Override
  protected void doInTransactionWithoutResult(TransactionStatus status) {
    sessionFactory.getCurrentSession().delete(jobAgentMetadata);
  }
});

代码示例来源:origin: gocd/gocd

@Override
  protected void doInTransactionWithoutResult(TransactionStatus status) {
    for (EnvironmentVariable variable : variables) {
      sessionFactory.getCurrentSession().delete(variable);
    }
  }
});

代码示例来源:origin: gocd/gocd

@Override
public boolean deleteUser(final String username) {
  return (Boolean) transactionTemplate.execute((TransactionCallback) status -> {
    User user = findUser(username);
    if (user instanceof NullUser) {
      throw new UserNotFoundException();
    }
    if (user.isEnabled()) {
      throw new UserEnabledException();
    }
    sessionFactory.getCurrentSession().delete(user);
    return Boolean.TRUE;
  });
}

代码示例来源:origin: denimgroup/threadfix

@Override
public void delete(DefaultConfiguration config) {
  sessionFactory.getCurrentSession().delete(config);
}

代码示例来源:origin: denimgroup/threadfix

@Override
public void delete(Document document) {
  sessionFactory.getCurrentSession().delete(document);
  
}

代码示例来源:origin: denimgroup/threadfix

@Override
public void delete(ScanResultFilter scanResultFilter) {
  sessionFactory.getCurrentSession().delete(scanResultFilter);
}

代码示例来源:origin: denimgroup/threadfix

@Override
public void delete(UserEventNotificationMap userEventNotificationMap) {
  sessionFactory.getCurrentSession().delete(userEventNotificationMap);
}

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

@Override
public void dropSession(AuthenticationSession session) {
  sessionFactory.getCurrentSession().delete(session);
}

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

public void delete(String id) throws HibernateException {
  FileRef ref = getFileRefById(id);
  if (ref != null) {
    factory.getCurrentSession().delete(ref);
  }
}

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

@Override
public boolean deleteGroup(long groupId) throws GeomajasSecurityException {
  Object group = factory.getCurrentSession().get(Territory.class, groupId);
  if (group != null) {
    factory.getCurrentSession().delete(group);
    return true;
  }
  return false;
}

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

@Override
public boolean deleteByAddress(String email) throws GeomajasSecurityException {
  User user = findByAddress(email);
  if (user != null) {
    factory.getCurrentSession().delete(user);
    return true;
  }
  return false;
}

代码示例来源:origin: denimgroup/threadfix

@Override
public void delete(int filterId) {
  VulnerabilityFilter filter = retrieveById(filterId);
  if (filter != null) {
    sessionFactory.getCurrentSession().delete(filter);
  }
}

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

@Override
public boolean deleteByAddress(String email) throws GeomajasSecurityException {
  User user = findByAddress(email);
  if (user != null) {
    factory.getCurrentSession().delete(user);
    return true;
  }
  return false;
}

代码示例来源:origin: denimgroup/threadfix

@Override
public void delete(Scan scan) {
  sessionFactory.getCurrentSession().save(new DeletedScan(scan));
  sessionFactory.getCurrentSession().delete(scan);
}

代码示例来源:origin: denimgroup/threadfix

@Override
public void deleteMap(ScanCloseVulnerabilityMap map) {
  sessionFactory.getCurrentSession().save(new DeletedCloseMap(map));
  sessionFactory.getCurrentSession().delete(map);
}

代码示例来源:origin: denimgroup/threadfix

@Override
public void delete(RemoteProviderApplication app) {
  sessionFactory.getCurrentSession().save(new DeletedRemoteProviderApplication(app));
  sessionFactory.getCurrentSession().delete(app);
}

代码示例来源:origin: denimgroup/threadfix

@Override
public void delete(Finding finding) {
  sessionFactory.getCurrentSession().save(new DeletedFinding(finding));
  sessionFactory.getCurrentSession().delete(finding);
}

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

@Transactional(rollbackFor = { Exception.class })
public void deleteGeodesk(Geodesk l) throws GeomajasSecurityException {
  if (((DeskmanagerSecurityContext) securityContext).deleteAllowed(l)) {
    factory.getCurrentSession().delete(l);
  } else {
    throw new GeomajasSecurityException(ExceptionCode.COMMAND_ACCESS_DENIED, "Verwijderen Geodesk",
        securityContext.getUserName());
  }
}

代码示例来源:origin: denimgroup/threadfix

@Override
public void delete(WafRule rule) {
  List<SecurityEvent> events = rule.getSecurityEvents();
  for (SecurityEvent event : events) {
    event.backUpWafRule();
    sessionFactory.getCurrentSession().save(event);
  }
  
  sessionFactory.getCurrentSession().save(new DeletedWafRule(rule));
  sessionFactory.getCurrentSession().delete(rule);
}

代码示例来源:origin: denimgroup/threadfix

@Override
  public void delete(Defect defect) {

    for (Event event: defect.getEvents()) {
      event.setDefect(null);
      eventDao.saveOrUpdate(event);
    }

    sessionFactory.getCurrentSession().save(new DeletedDefect(defect));
    sessionFactory.getCurrentSession().delete(defect);
  }
}

相关文章