
document 데이터 insert 하는 방법 { key : value } object 형태로 document 데이터를 insert 한다. insertOne() 으로 한개 데이터 넣기 db.diary.insertOne({ "content" : "재미있는 오늘!", "userId" : 11, "weather" : "sunny", "writtenAt" : "2023-02-18T00:00:00.000Z", "deleted" : false}); insertMany()로 여러개의 데이터 넣기 [ {}, {}, ...] 배열로 데이터를 넣는다. db.diary.insertMany([ { "content" : "hello world", "userId" : 22, "weather" : "cloudy", "written..
kotlin 함수 ?.null { it } where 조건 안에서 특정 파라미터 값을 체크해 데이터 유무에 따라 사용할 수 있다. fun findByIdAndName(id: Long, name:String): List { return from(members) .where(members.id.eq(id), name?.let { members.name.eq(it) }) .fetch() } 코틀린에서 제공하는 함수를 queryDsl 쿼리문 안에서도 사용 가능하다. ?. : null 이 아닐 때 let { } : it 으로 자기 자신을 받아와서 객체의 상태를 변경할 수 있다. ?.let { null이 아닐 때 블럭을 실행한다. }
@BatchSize 연관된 엔티티를 조회할 때 지정한 size 만큼 where 조건의 in 절으로 조회한다. 1:N 관계의 Entity 정의 정의 조건 : 1명의 멤버는 여러 개의 주문을 가질 수 있다. Members (1) : Orders (N) * 부모 class : Members @Entity class Members( @Column(nullable = false, length = 50) var email: String, @Column(nullable = false, length = 20) var name: String, ) { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) var id: Long? = null @OneToMany(mappedBy..

에러 메세지 org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags: [com.beside.backend.domain.entitiy.wisesaying.WiseSaying.emotionWiseSayingsWords, com.beside.backend.domain.entitiy.wisesaying.WiseSaying.wiseSayingBookmark]; nested exception is java.lang.IllegalArgumentException: org.hibernate.loader.Mult..

사건의 발단 로그인 API가 안된다는 프론트엔드 팀원님의 갑작스런 메세지..... 보고 현기증나기 시작했다.ㅎ 왜냐면 함께 하던 백엔드 팀원님이 나가셔서 이제 내가 무조건 처리해야하기 때문에.. (처리 못하면 죽음뿐 ^^) 문제 상황 * Database server 접속 안됨 (MySQL Cannot Connect to Database Server) 디비 데이터 모두 초기화됨 * domain 접속 안됨 해결 방법 데이터베이스 도커 컨테이너 재기동 서버가 네이버 클라우드로 돌아가고 있는데 프로젝트 기간이 얼마 남지 않은 시점이라 처음에 크레딧 소멸을 의심했다. 다행히 아직 크레딧은 남아 있어서 클라우드에서 서버가 내려간건 아니었다. 그렇다면 디비 서버만 연결이 안된다는 건데, 여기서 클라우드 서버와 디비 ..

사용자의 구독 이력UserSubscribeHistory 을 확인하는 find 함수 기존 JPA Query 다음 코드는 사용자가 해당 채널을 구독하는지 조회하는 JPA Query이다. 사용자의 구독 이력 UserSubscribeHistory 에서 구독하는 채널명 channelName 인지 확인하고 UserSubscribeStatus 구독 상태 여부에 따라 UserSubscribeHistory를 반환한다. fun find(channelName: String, status: UserSubscribeStatus? = null): UserSubscribeHistory? { return queryFactory.select(userSubscribeHistory) .from(userSubscribeHistory) .w..

실행한 쿼리 delete from wise_saying_bookmark where wise_saying_id = 1 특정 행을 삭제하기 위해 쿼리문을 delete 쿼리문을 실행했다. 에러메세지 Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect. 원인 "safe update mode" 기능이 활성화되어 있을 때 발생한다. 데이터가 무작위로 수정되는 것을 방지하기 위한 기능으로, update / d..
Full Text Search Index (전문 검색 인덱스) MongoDB에서 제공하는 Full Text Search (전문 검색) 기능을 사용하여 검색 기능을 구현하던 중 에러가 발생하였다. Text index required for $text query Full Text Search Index 를 생성하지 않아 발생하는 에러 Full Text Search Index 생성하기 Collection level db.컬렉션명.createIndex( { "$**": "text" } ) Field level db.컬렉션명.createIndex( { title: "text", contents: "text" } ) Full Text Search Index 삭제 index 의 이름으로 삭제한다. db.컬렉션명.dr..
- Total
- Today
- Yesterday
- bucket4j
- 추상클래스
- Git
- checkout
- Cannot construct instance of
- redisson 분산락
- Kotlin
- junit5
- 오블완
- 스프링 스케줄링
- 스프링오류
- jvm warm-up 전략
- FetchJoin
- QueryDSL
- addFilterBefore
- Linux
- array
- JPA
- Spring Security
- n+1
- ChatGPT
- 배열
- dto 클래스 생성자
- spring boot 3
- 자바 어플리케이션 실행 과정
- port
- MongoDB
- Java
- 티스토리챌린지
- MultipleBagFetchException
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |