Springdata like keyword does not work

Source: Internet
Author: User

The LIKE keyword does not work when using Springdata simple query

hibernate:select article0_.oid as Oid1_2_, article0_.articleabstract as Articlea2_2_, Article0_.articleauthoremail as Articlea3_2_, Article0_.articlecommentcount as Articlec4_2_, article0_. Articlecommentable as Articlec5_2_, article0_.articlecontent as Articlec6_2_, article0_.articlecreatedate as ArticleC7 _2_, Article0_.articleeditortype as Articlee8_2_, article0_.articlehadbeenpublished as ArticleH9_2_, article0_. Articleispublished as Article10_2_, Article0_.articlepermalink as Article11_2_, article0_.articleputtop as Article12_2 _, article0_.articlerandomdouble as Article13_2_, Article0_.articlesignid as article14_2_, article0_.articleTags as Article15_2_, Article0_.articletitle as Article16_2_, article0_.articleupdatedate as Article17_2_, article0_. Articleviewcount as Article18_2_, article0_.articleviewpwd as article19_2_ from article article0_ where article0_.articletitle like  ? or article0_.articleabstract like? or Article0_.articlecontent?

The query statement shows that although the like keyword is used, there is no fuzzy matching

Workaround:

Converts the passed-in keyword to a fuzzy match character, "%" or "*"

keyword= "%" +keyword+ "%";

Springdata like keyword does not work

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.