范例如下,蒙了一个setEntity,出乎意料的可以
public StudentBean findcurrstudent(String username) {
// TODO Auto-generated method stub
UserBean ub = (UserBean)getSession().createQuery("from UserBean user where user.username=?").setString(0, username).uniqueResult();
return (StudentBean)getSession().createQuery("from StudentBean stu where stu.userBean=?")
.setEntity(0, ub).uniqueResult();
}