本文整理了Java中org.hibernate.classic.Session.save()
方法的一些代码示例,展示了Session.save()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Session.save()
方法的具体详情如下:
包路径:org.hibernate.classic.Session
类名称:Session
方法名:save
[英]Persist the given transient instance, using the given identifier. This operation cascades to associated instances if the association is mapped with cascade="save-update".
[中]使用给定的标识符持久化给定的瞬态实例。如果关联映射为cascade=“save update”,则此操作将级联到关联实例。
代码示例来源:origin: gocd/gocd
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
sessionFactory.getCurrentSession().save(metadata);
}
});
代码示例来源:origin: gocd/gocd
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
for (EnvironmentVariable variable : variables) {
EnvironmentVariable environmentVariableConfig = new EnvironmentVariable(variable.getName(), variable.getValue(), variable.isSecure());
environmentVariableConfig.setEntityId(entityId);
environmentVariableConfig.setEntityType(type.toString());
sessionFactory.getCurrentSession().save(environmentVariableConfig);
}
}
});
代码示例来源:origin: denimgroup/threadfix
@Override
public void saveOrUpdate(VulnerabilityComment comment) {
sessionFactory.getCurrentSession().save(comment);
}
代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-printing
/** {@inheritDoc} */
public void merge(PrintTemplate template) throws IOException {
sessionFactory.getCurrentSession().save(template);
}
代码示例来源:origin: madvirus/spring4
@Override
public void save(PurchaseOrder order) {
sessionFactory.getCurrentSession().save(order);
}
代码示例来源:origin: madvirus/spring4
@Override
public void save(PaymentInfo paymentInfo) {
sessionFactory.getCurrentSession().save(paymentInfo);
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
@Transactional(readOnly = false)
public void addCustomer(Customer customer) {
sessionFactory.getCurrentSession().save(customer);
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
@Transactional(readOnly = false)
public void addCustomers(Map<String, Customer> customerMap) {
Collection<Customer> customerCol = customerMap.values();
for (Customer customer : customerCol) {
sessionFactory.getCurrentSession().save(customer);
}
}
代码示例来源:origin: org.n52.sensorweb/52n-sps-hibernate
public void saveInstance(SensorConfiguration instance) {
LOGGER.debug("saveInstance({})", instance);
getCurrentSession().save(instance);
}
代码示例来源:origin: denimgroup/threadfix
@Override
public void deleteMap(ScanReopenVulnerabilityMap map) {
sessionFactory.getCurrentSession().save(new DeletedReopenMap(map));
sessionFactory.getCurrentSession().delete(map);
}
代码示例来源:origin: denimgroup/threadfix
@Override
public void deleteMap(ScanRepeatFindingMap map) {
sessionFactory.getCurrentSession().save(new DeletedRepeatFindingMap(map));
sessionFactory.getCurrentSession().delete(map);
}
代码示例来源: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: denimgroup/threadfix
@Override
public void delete(Scan scan) {
sessionFactory.getCurrentSession().save(new DeletedScan(scan));
sessionFactory.getCurrentSession().delete(scan);
}
代码示例来源: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);
}
}
代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-deskmanager
@Override
public User createUser(String name, String surname, String email, String password)
throws GeomajasSecurityException {
User user = new User();
user.setActive(true);
user.setName(name);
user.setSurname(surname);
user.setEmail(email);
// TODO: check password strength + security
user.setPassword(encodePassword(email, password));
factory.getCurrentSession().save(user);
return user;
}
代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-deskmanager
@Override
public Territory createGroup(String name, String key, String crs, Geometry geometry, String categoryId)
throws GeomajasSecurityException {
TerritoryCategory category = findCategoryById(categoryId != null ? categoryId : DEFAULT_CATEGORY_ID);
Territory group = new Territory();
group.setName(name);
group.setCode(key);
group.setCrs(crs);
group.setGeometry(geometry);
group.setCategory(category);
factory.getCurrentSession().save(group);
return group;
}
代码示例来源:origin: org.geomajas/geomajas-project-deskmanager
@Override
public Territory createGroup(String name, String key, String crs, Geometry geometry, String categoryId)
throws GeomajasSecurityException {
TerritoryCategory category = findCategoryById(categoryId != null ? categoryId : DEFAULT_CATEGORY_ID);
Territory group = new Territory();
group.setName(name);
group.setCode(key);
group.setCrs(crs);
group.setGeometry(geometry);
group.setCategory(category);
factory.getCurrentSession().save(group);
return group;
}
内容来源于网络,如有侵权,请联系作者删除!