h2 console
runtimeOnly 'com.h2database:h2'
: 테스트용
app.properties
spring.h2.console.enabled=true
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
http://localhost:8080/h2-console → DB로 접근
로그 중 jdbc url (오늘은 jdbc:h2:mem:43be176b-c8a0-4345-bf9e-6434ddaff4e4) 입력하고 커넥트
controller랑 request 사이에서 연결해주는 service!
domain - repository 연결
Member & dto.PostUserRequest
Rest API - CRUD
modelmapper → dependencieds에 추가, ‘@Bean에 선언
Test PUT OBJECT
PostUserRequest(id=3, userId=12345678, name=홍길동, [email=aaa@hufs.ac.kr](mailto:email=aaa@hufs.ac.kr), address=hufs, password=999, phoneNumber=010-1234-9999)
Hibernate:
select
member0_.id as id1_0_,
member0_.address as address2_0_,
member0_.email as email3_0_,
member0_.name as name4_0_,
member0_.password as password5_0_,
member0_.phone_number as phone_nu6_0_,
member0_.user_id as user_id7_0_
from
users member0_
where
member0_.user_id=?
and member0_.email=?
and member0_.name=?
Hibernate:
update
users
set
address=?,
email=?,
name=?,
password=?,
phone_number=?,
user_id=?
where
id=?
어려운 db의 세계…
Swagger에서 추가/삭제 가능
Usercontroller의 register(등록), update(수정), delete(삭제)
swagger에서 사용자 register 하고 USERS - Run 해보면
짜잔
다른 기능들도 확인할 수 있음
AWS는 1년만 무료, Oracle DB는 무료!