求救啊这个为什么没有结果出来啊到底那里错了 这句代码为什么没有结果出来 List<Staff> result=this.getHibernateTemplate().findByNamedParam("from Staff as i where i.name =:myname", "myname", "22"); 改成这句也错误 List<Staff> result=this.getHibernateTemplate().find("from Staff as i where i.name =?","22");
------解决方案--------------------
Query query = this.getSession.CreateQuery("from Staff as i where i.name=?"); query.setString(1,"22"); List<Staff> result = (List<Staff>)query.list(); 楼主这样试试看!
------解决方案--------------------
List<Staff> result=this.getHibernateTemplate().findByNamedParam("from Staff as i where i.name in("myname", "myname", "22")); 这样呢?