现在的位置: 首页 > 综合 > 正文

HibernateTemplate的使用查询的方法find(),bulkupdate(),findByNamedParam()

2013年04月17日 ⁄ 综合 ⁄ 共 410字 ⁄ 字号 评论关闭

1

		String hql = "select password from User where username=?";
		List<String> lst = hibernateTemplate.find(hql, user.getUsername());

2

		template.bulkUpdate("delete from Directory where user=? and parentPath like ?", new Object[]{userInfo.getCookieUser(), path + "%"});

使用 bulkUpdate进行批量 更新,两个参数代表用?预定义

3

多参数hql查询

template
				.findByNamedParam(
						"from File where user = :user and path = :path order by uploadTime",
						new String[]
						{ "user", "path" }, new Object[]
						{ username, path });

抱歉!评论已关闭.