LIKE usage in hibernate

xiaoxiao2021-03-06  53

Original my way: query repeatclientQuery = querysession.createQuery ("from clientinfo as a" "where a.client_name like: name"); RepeatClientQuery.SetParameter ("name", clientname); Query has no results. Programming prodigal node: Like 'MC%' will search all strings (such as MCBADDEN) at the beginning of the letter MC. Like '% inger' will search all strings (such as Ringer, Stringer) ending with the letter INGER. Like '% en%' will search all strings (such as Bennet, Green, McBAdden) in any location. Like '_heryl' will search for all six letters of the six letters ending with the letter heryl (such as Cheryl, Sheryl). Like '[CK] ARS [EO] N' will search the following string: Carsen, Karsen, Carson and Karson (such as Carson). Like '[m-z] inger' will search for all the names starting from any single letter from M to Z. Like 'm [^ c]%' begins with the letter M in the letter M, and the second letter is not all names of C (such as Macfeather).

You directly write string SQL = "from clientinfo as a where a.client_name like '%" ClientName "%'"); query repeatclientQuery = querysession.createQuery (SQL); success.

转载请注明原文地址:https://www.9cbs.com/read-83977.html

New Post(0)