Hibernate Envers란Hibernate Envers는 엔티티의 변경 이력(Revision History)을 자동으로 추적하고 저장해 주는 기능이다. @Entity로 정의된 테이블의 INSERT/ UPDATE / DELETE 시점마다 자동으로 감사(Audit) 테이블에 변경된 데이터를 기록한다. 만약에 User 엔티티가 있다면 아래와 같은 테이블이 생성된다.테이블 이름용도user실제 데이터user_aud변경 이력(Audit) 데이터revinfo각 revision(이력)의 메타데이터 주요 개념개념설명Revision데이터 변경이 발생한 “이력 단위”를 의미. 각 Revision에는 고유한 ID와 타임스탬프가 존재Audit Table (_AUD)각 엔티티의 이력을 저장하는 별도의 테이블RevisionE..
RestClientIntroRestclient is a synchronous HTTP Client.A synchrounous HTTP client sends and receives HTTP requests and responses in a blocking manner. Restclient features a fluent API.A fluent API is a design pattern that allows method chaining in a way that makes the code more readable and expressive by sequentially calling methods on an object.RestClient restClient = RestClient.create();create..
Spring + Postgresql JSONB 타입 처리하기PostgreSQL은 관계형 데이터베이스이면서도 문서형(JSON) 데이터 구조를 동시에 지원한다. 특히 jsonb 타입은 빠른 검색과 인덱싱을 제공해, 반정형 데이터(semi-structured data)를 효율적으로 다룰 수 있다. 하지만 문제는, Spring Data JPA가 JSON 컬럼을 기본적으로 지원하지 않아, 👉 hibernate-types 라이브러리를 추가해야 한다. import com.vladmihalcea.hibernate.type.json.JsonTypeimplementation("org.springframework.boot:spring-boot-starter-data-jpa")implementation("org.pos..
STOMP란Simple Text Oriented Messaing Protocol의 약자텍스트 기반의 경량 메시징 프로토콜로, 웹에서 Websocket과 함께 사용하여 서버-클라이언트 간의 메시지 통신을 쉽게 구축할 수 있다.클라이언트와 서버가 전송할 메시지 유형, 형식, 내용들을 정의하는 메커니즘기본적으로 Publish-Subscribe 구조로 되어있다.Publish-Subscribe 구조란 메시지를 공급하는 주체와 소비하는 주체를 분리하여 제공하는 메시징 방법이다. STOMP 기능 STOMP 메시지 구조SENDdestination:/chat/room/123content-type:application/json{ "message": "Hello!" }SEND: 메시지 전송하는 명령destination: 메..