Positional parameter are considered deprecated; use named parameters or JPA-style positional parameters instead.
这行代码:
1 List<Cat> catList =session.createQuery("from Cat p where p.name.first_name=?").setParameter(0,name.getFirst_name()).list();
改为:
1 String hql = "from Cat p where p.name.first_name=:name"; 2 Query query = session.createQuery(hql); 3 query.setParameter("name", name.getFirst_name()); 4 List<Cat> catList = query.list();