like와 contains의 차이
like는 컬럼의 풀텍스트가 일치하는 것만 출력
앞뒤에 %를 붙이면 부분만 일치해도 리스트가 출력
contains는 like 앞뒤에 %를 붙인것과 동일한 결과가 출력된다.
public List<Student> findByNameLike(String name);
Hibernate:
select
student0_.id as id1_0_,
student0_.name as name2_0_,
student0_.roll_number as roll_number3_0_,
student0_.university as university4_0_
from
student student0_
where
student0_.name like ?
public List<Student> findByNameContaining(String name);
Hibernate:
select
student0_.id as id1_0_,
student0_.name as name2_0_,
student0_.roll_number as roll_number3_0_,
student0_.university as university4_0_
from
student student0_
where
student0_.name like ?
'SpringBoot' 카테고리의 다른 글
[Springboot] URL로 이미지 다운로드 (0) | 2020.12.23 |
---|---|
[Java] @Deprecated (0) | 2020.10.27 |
[Intellij] test events were not received (0) | 2020.08.10 |
[Intellij] 디버깅이 너무 오래걸릴때 해결 방법 (1) | 2020.08.10 |
Connection com.mysql.cj.jdbc.ConnectionImpl@29ec2b10 marked as broken because of SQL (0) | 2020.07.30 |