Hibernate預留位置問題[use named parameters or JPA-style positional

來源:互聯網
上載者:User

[main] WARN  [org.hibernate.hql.internal.ast.HqlSqlWalker] – [DEPRECATION] Encountered positional parameter near line 1, column 95.  Positional parameter are considered deprecated; use named parameters or JPA-style positional parameters instead.

String hql = "select t from Blog t where t.site=?";Query query = getSession().createQuery(hql);query.setParameter(0, "micmiu.com");

//具名引數的方式String hql2 = "select t from Blog t where t.site=:site";Query query2 = getSession().createQuery(hql2);query2.setParameter("site", "micmiu.com");

//JPA預留位置方式String hql3 = "select t from Blog t where t.site=?0";Query query3 = getSession().createQuery(hql3);query2.setParameter(0, "micmiu.com");

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.