1. API
2. JPA 쿼리 참고
https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods
Spring Data JPA - Reference Documentation
Example 119. Using @Transactional at query methods @Transactional(readOnly = true) interface UserRepository extends JpaRepository { List findByLastname(String lastname); @Modifying @Transactional @Query("delete from User u where u.active = false") void del
docs.spring.io
5.1.3 Query Methods
Query Creation
Query Creation
Generally, the query creation mechanism for JPA works as described in “Query Methods”. The following example shows what a JPA query method translates into:
public interface UserRepository extends Repository<User, Long> {
List<User> findByEmailAddressAndLastname(String emailAddress, String lastname);
}
We create a query using the JPA criteria API from this, but, essentially, this translates into the following query: select u from User u where u.emailAddress = ?1 and u.lastname = ?2. Spring Data JPA does a property check and traverses nested properties, as described in “Property Expressions”.
The following table describes the keywords supported for JPA and what a method containing that keyword translates to:
Table 3. Supported keywords inside method namesKeywordSampleJPQL snippet
Distinct | findDistinctByLastnameAndFirstname | select distinct … where x.lastname = ?1 and x.firstname = ?2 |
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 |
LessThanEqual | findByAgeLessThanEqual | … where x.age <= ?1 |
GreaterThan | findByAgeGreaterThan | … where x.age > ?1 |
GreaterThanEqual | findByAgeGreaterThanEqual | … where x.age >= ?1 |
After | findByStartDateAfter | … where x.startDate > ?1 |
Before | findByStartDateBefore | … where x.startDate < ?1 |
IsNull, Null | findByAge(Is)Null | … where x.age is null |
IsNotNull, NotNull | findByAge(Is)NotNull | … where x.age not null |
Like | findByFirstnameLike | … where x.firstname like ?1 |
NotLike | findByFirstnameNotLike | … where x.firstname not like ?1 |
StartingWith | findByFirstnameStartingWith | … where x.firstname like ?1 (parameter bound with appended %) |
EndingWith | findByFirstnameEndingWith | … where x.firstname like ?1 (parameter bound with prepended %) |
Containing | findByFirstnameContaining | … where x.firstname like ?1 (parameter bound wrapped in %) |
OrderBy | findByAgeOrderByLastnameDesc | … 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 |
NotIn | findByAgeNotIn(Collection<Age> ages) | … where x.age not in ?1 |
True | findByActiveTrue() | … where x.active = true |
False | findByActiveFalse() | … where x.active = false |
IgnoreCase | findByFirstnameIgnoreCase | … where UPPER(x.firstname) = UPPER(?1) |
3. HTML 기초
https://www.codecademy.com/learn/learn-html
Learn HTML | Codecademy
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.
www.codecademy.com
https://opentutorials.org/course/2039
HTML 수업 - 생활코딩
수업의 목적 본 수업은 HTML에 대한 심화된 내용을 다룹니다. HTML의 기본문법과 HTML의 주요한 태그들에 대한 수업을 담고 있습니다. 선행학습 본 수업을 효과적으로 수행하기 위해서는 웹애플리
opentutorials.org
4. JQuery
CDN : <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
보이기 : $('#post-box').show();
숨기기 : $('#post-box').hide();
값 가져오기 : $('#post-url').val();
값 넣기 : $('#post-url').val('new text');
HTML 요소 비우기 : $('#cards-box').empty();
HTML 요소 추가하기 : $('#cards-box').append(temp_html);
5. 숙제
서비스가 불러오는 메모 목록의 시간을 조회 시간으로부터 24시간 이내로 바꿔보자
힌트1) spring jpa localtime between 구글링
힌트2) 지금은 LocalDateTime.now(), 어제는 LocalDateTime.now().minusDays(1)
'웹 개발 > 스프링' 카테고리의 다른 글
[스프링 부트 심화] 스프링 동작 원리 (0) | 2023.04.08 |
---|---|
[스프링 부트 기초] 스프링 나만의 셀렉샵 (0) | 2023.04.07 |
[스프링 부트 기초] 스프링과 데이터베이스 (1) | 2023.04.03 |
[스프링 부트 기초] RESTful Controller (0) | 2023.03.29 |
[스프링 부트 기초] 프로젝트 셋팅하기 (0) | 2023.03.28 |