我顶!中国IT人才网( http://www.itbbs.net.cn )!中国IT人才网( http://www.itbbs.net.cn )!中国IT人才网( http://www.itbbs.net.cn )!中国IT人才网( http://www.itbbs.net.cn )!中国IT人才网( http://www.itbbs.net.cn )!中国IT人才网( http://www.itbbs.net.cn )!中国IT人才网( http://www.itbbs.net.cn )!中国IT人才网( http://www.itbbs.net.cn )!中国IT人才网( http://www.itbbs.net.cn )!中国IT人才网( http://www.itbbs.net.cn )!中国IT人才网( http://www.itbbs.net.cn )!
免费招聘、求职。IT人工作的天堂。希望能够为大家所用。
免费招聘、求职。IT人工作的天堂。希望能够为大家所用。
解决方案 »
- eclipse中怎么安装jbpm-jpdl-suite-3.2.2
- 报表问题?急!急!急!
- struts中文显示的问题
- 再问hibernate关系,当一对多时,多的那方添加数据,一的那方同添加?(不能是不是就是没建立双向关系?还是理解错误)
- struts中同名action的问题
- CMP中datasourcemapping是干什么用的?
- 救命呀...
- 紧急求教:j2ee怎么实现MVC的?我觉得jsp无法notify啊
- 路过的高手救救我,我一直在线,还有一口气!100分不够再加
- 求IdentityHashMap顺序的问题,非常急
- hibernate+spring的配置文件问题
- weblogic部署的WAR
* 根据部门标识,删除部门信息
* @param deptId
*/ public void remove(String deptId) {
Department department = null;
try {
//先生成sessionFactory
SessionFactory sessions = cfg.buildSessionFactory();
//再从sessionFactory得到一个session
Session session = sessions.openSession();
//启动事务
Transaction tx = session.beginTransaction(); Query query = session.createQuery(
"select Department from Department as Department where Department.deptId=:deptId");
query.setString("deptId", deptId);
if (query.iterate().hasNext()) {
for (Iterator it = query.iterate(); it.hasNext(); ) {
department = (Department) it.next();
session.delete(department);
logger.info("删除的部门标识为: " + department.getDeptId());
}
}
else {
logger.warn("该部门信息不存在!");
}
tx.commit();
session.close();
}
catch (Exception ex1) {
}
} /**
* 修改机构信息
* @param department
*/ public void update(Department department) {
try {
//先生成sessionFactory
SessionFactory sessions = cfg.buildSessionFactory();
//再从sessionFactory得到一个session
Session session = sessions.openSession();
//启动事务
Transaction tx = session.beginTransaction(); //更新一条记录
session.update(department); tx.commit();
session.close();
}
catch (Exception ex) {
} }
department.member_count=10;
}
update(department);
先将department对象的member_count改为10,在调用update方法。