作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在 Hibernate Criteria 中编写以下 InsertInto 查询。有什么建议 ..感谢您的帮助
sql = "insert into selectedresumes values('" + companyId + "','"
+ resumeId + "','" + resumeStatusId + "','" + jobId + "')";
最佳答案
不幸的是,你做不到。
根据Hibernate文档
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#batch-direct
Only the INSERT INTO ... SELECT ... form is supported; not the INSERT INTO ... VALUES ... form.
所以你只需要创建对象并使用 Hibernate 保存它,它应该看起来像这样
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
Resume selectedresumes = new Resume();
//set all resume values
session.save(selectedresumes);
tx.commit();
session.close();
关于hibernate - 如何在 hibernate 条件中编写insertinto命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6241410/
我是一名优秀的程序员,十分优秀!