Hibernate placeholder [use named parameters or JPA-style positional

Source: Internet
Author: 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");

// Name the parameter String hql2 = "select t from Blog t where t. site =: site "; Query query2 = getSession (). createQuery (hql2); query2.setParameter ("site", "micmiu.com ");

// JPA placeholder mode String hql3 = "select t from Blog t where t. site =? 0 "; Query query3 = getSession (). createQuery (hql3); query2.setParameter (0," micmiu.com ");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.