ORM
- 객체와 테이블을 매핑함
- ex) @Entity 붙은 클래스와 데이터 베이스 테이블과 매핑하고 원하는 결과를 가져옴
SQL Mapper
- SQL 결과를 객체에 자동으로 매핑함
- ex) @Entity 붙은 클래스 필요 없고 sql 결과를 담을 수 있는 객체에 결과를 담아서 사용
- 직접 쿼리를 작성해야하지만 쿼리를 객채를 할 수 있음
| 키워드 | 샘플 | JPQL |
| And | findByLastnameAndFirstname | … where x.lastname = ?1 and x.firstname = ?2 |
| Or | findByLastnameOrFirstname | … where x.lastname = ?1 or x.firstname = ?2 |
| Is, Equals | findByFirstname,findByFirstnameIs,findByFirstnameEquals | … where x.firstname = ?1 |
| Between | findByStartDateBetween | … where x.startDate between ?1 and ?2 |
| LessThan | findByAgeLessThan | … where x.age < ?1 |
| Like | findByFirstnameLike | … where x.firstname like ?1 |
| NotLike | findByFirstnameNotLike | … where x.firstname not like ?1 |
| OrderBy | findAllByAgeOrderByLastnameDesc | … where x.age = ?1 order by x.lastname desc |
| Not | findByLastnameNot | … where x.lastname <> ?1 |
| In | findByAgeIn(Collection<Age> ages) | … where x.age in ?1 |
| TRUE | findByActiveTrue() | … where x.active = true |
| FALSE | findByActiveFalse() | … where x.active = false |
'내일배움캠프 > 회고록' 카테고리의 다른 글
| 9월 11일 (1) | 2024.09.12 |
|---|---|
| 8월 23일 금요일 (0) | 2024.08.26 |
| 8월 19일 월요일 (0) | 2024.08.20 |
| 8월 13일 화요일 (0) | 2024.08.14 |
| 8월 12일 월요일 (0) | 2024.08.12 |