본문 바로가기
카테고리 없음

[스터디] 스프링 부트 개념과 활용 - 8주차 ( ~ 4/17)

by shakevan 2022. 4. 16.

Spring Data JPA

- JPA Spec을 손쉽게 사용할 수 있도록 제공하는 라이브러리(?)

- 하이버네이트 기반으로 구현되어 있음

https://docs.spring.io/spring-data/jpa/docs/current/reference/html/

 

Spring Data JPA - Reference Documentation

Example 109. 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

 

 

데이터베이스 초기화 방법

1안) spring.jpa.hibernate.ddl-auto : create,update,create-drop, validate

2안) spring.jpa.generate-ddl : true, false

 

FlyWay(DB migration tool)

spring boot 사용시 flyway-core만 의존성 추가해줘도 잘됨

 

- 한번 추가된 파일은 수정하면 안됨(fly_schema_history에서 에러 터짐)

https://kwonnam.pe.kr/wiki/java/database/migration/flyway

 

java:database:migration:flyway [권남]

 

kwonnam.pe.kr

 

 

Spring Data Redis

https://docs.spring.io/spring-data/data-redis/docs/current/reference/html/

 

Spring Data Redis

Some commands (such as SINTER and SUNION) can only be processed on the server side when all involved keys map to the same slot. Otherwise, computation has to be done on client side. Therefore, it is useful to pin keyspaces to a single slot, which lets make

docs.spring.io

 

StringRedisTemplate vs CrudRepository

댓글