Keywords for Spring Data JPA conditional query

Source: Internet
Author: User

Spring Data JPA provides a number of keywords to express conditional queries for this purpose, roughly as follows:

and---are equivalent to the AND keyword in SQL, such as Findbyusernameandpassword (String user, Striang pwd);
The or---is equivalent to the OR keyword in SQL, such as findbyusernameoraddress (string user, String addr);
The between---is equivalent to the between keyword in SQL, such as Findbysalarybetween (int max, int min);
The LessThan---is equivalent to "<" in SQL, such as Findbysalarylessthan (int max);
GreaterThan---is equivalent to ">" in SQL, such as Findbysalarygreaterthan (int min);
IsNull---is equivalent to "is null" in SQL, such as Findbyusernameisnull ();
Isnotnull---is equivalent to "is not NULL" in SQL, such as Findbyusernameisnotnull ();
Notnull---and isnotnull equivalence;
The like---is equivalent to the "as" in SQL, such as Findbyusernamelike (String user);
The notlike---is equivalent to "not like" in SQL, such as Findbyusernamenotlike (String user);
The order-by---is equivalent to the "FINDBYUSERNAMEORDERBYSALARYASC" in SQL, such as the String user;
The not---is equivalent to "in SQL"! = ", such as Findbyusernamenot (String user);
In---is equivalent to ' in ' in SQL, such as Findbyusernamein (Collection<string> userlist), the parameter of the method can be either a Collection type or an array or an indefinite length parameter;
The notin---is equivalent to "not in" SQL, such as Findbyusernamenotin (Collection<string> userlist), which can be either a Collection type or an array or not Fixed length parameters;

Keywords for Spring Data JPA conditional query

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.