public List<Application> findByEmp(Employee emp)
{
return (List<User>)getHibernateTemplate().find("from Application as a where" +
"a.attend.employee=?", emp);
}请问 find方法中 ? 这个 占位符 后面 那个 emp 参数 是什么意思,
还有 find方法中的 HQL 语句必须要写成 带 + 连接符 这样的 格式 吗 可不可以不写 加号 呢?
{
return (List<User>)getHibernateTemplate().find("from Application as a where" +
"a.attend.employee=?", emp);
}请问 find方法中 ? 这个 占位符 后面 那个 emp 参数 是什么意思,
还有 find方法中的 HQL 语句必须要写成 带 + 连接符 这样的 格式 吗 可不可以不写 加号 呢?
hibernate API是这样写的。
public List find(String query,
Object value,
Type type)
throws HibernateException Deprecated. use Session.createQuery(java.lang.String).setXYZ.Query.list() Execute a query with bind parameters, binding a value to a "?" parameter in the query string.
Parameters:query - the query stringvalue - a value to be bound to a "?" placeholder (JDBC IN parameter).type - the Hibernate type of the value Returns:a distinct list of instances (or arrays of instances) Throws: HibernateExceptionSee Also:for access to Type instances