JPA where 구문
JPA where 구문
JPA where 구문
JPA로 where 구문 만드는 방법을 알아보자.
1. where username =
Optional<User> findByUsername(String username);
2. where username <> // not
Optional<User> findByUsernameNot(String username);
3. where username = ? and othername = ?
Optional<User> findByUsernameAndothername(String username, String othername);
4. where username = ? or othername = ?
Optional<User> findByUsernameOrothername(String username, String othername);
5. where score between ? and ?
Optional<User> findByScoreBetween(int score1, int score2);
6. where username < ?
Optional<User> findByScoreLessThan(int Score);
7. where username > ?
Optional<User> findByScoreGreaterThan(int Score);
8. where username <= ?
Optional<User> findByScoreLessThanEqual(int Score);
9. where username >= ?
Optional<User> findByScoreGreaterThanEqual(int Score);
10. where username is null
Optional<User> findByUsernameisNull();
11. where username is not null
Optional<User> findByUsernameisNotNull();