본문 바로가기
728x90
반응형

spring/spring jpa7

[SpringBoot] JPA Comment (주석 추가) 설정 방법 JPA Comment (주석 추가) 설정 방법 application.yml spring: jpa: properties: hibernate: show_sql: false format_sql: true use_sql_comments: true# sql comments 사용 1. JPA Repository에 적용 방법 To apply JPA QueryHints to the queries declared in your repository interface you can use the QueryHints annotation. It takes an array of JPA QueryHint annotations plus a boolean flag to potentially disable the hints applie.. 2024. 2. 2.
[QueryDSL] FullText 검색을 위한 Match ... against 절 사용법 MySQL에서 FullText 인덱스 검색을 하기 위해서는 MATCH(), AGAINST() 절을 사용해야합니다. (풀텍스트 인덱스에 대한 설명은 다른 블로그 포스팅을 참고해주세요.) 기존에 dialect는 MySQL5Dialect를 사용하고 있었습니다. properties.put("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect"); MySQL5Dialect를 커스텀하겠습니다. package com.moonsiri.config.hibernate.dialect; import org.hibernate.dialect.MySQL5Dialect; import org.hibernate.dialect.function.SQLFunctionTemplate; impo.. 2023. 8. 24.
[SpringBoot] QueryDSL org.apache.jasper.JasperException: Unable to compile class for JSP: 배경 JSP를 사용하는 환경에서 QueryDSL 라이브러리를 추가 후 빌드 시 'QueryDSL org.apache.jasper.JasperException: Unable to compile class for JSP:' 오류가 발생 원인 querydsl-apt 내 org.eclipse.jdt.core.compiler:ecj 종속성 강제 해결 querydsl-apt에 org.eclipse.jdt.core.compiler:ecj 종속성 제외 com.querydsl querydsl-apt provided org.eclipse.jdt.core.compiler ecj 2023. 8. 24.
[SpringBoot] JPA Master/Slave 구조 분기 처리 서비스를 운영하다 보면 데이터베이스가 여러 개의 노드로 분산되어 Master/Slave 구조로 이루어져 있는 경우가 많습니다. 보통 두가지 방법으로 분기처리가 가능한데요. 본 포스팅에서는 @Transactional 어노테이션을 사용하는 방식을 소개해드리겠습니다. 먼저 Transactional readOnly에 따라 분기하는 CustomRoutingDataSource를 생성합니다. import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; import org.springframework.transaction.support.TransactionSynchronizationManager; public class RoutingDataS.. 2023. 8. 23.
[SpringBoot] JPA Projection Projection은 Entity의 속성이 많을 때 일부 데이터만 조회하는 방법입니다. 아래 UserEntity를 참고하여 설명하겠습니다. @Entity @Table(name = "user") @NoArgsConstructor(access = AccessLevel.PROTECTED) public class UserEntity { @Id @Column(name = "user_id", nullable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) private Long userId; @Column(length = 50, nullable = false) private String name; @Column(length = 50, nullable = .. 2021. 6. 23.
[Spring] JPA 연관 관계 매핑 및 제거 user와 dept 테이블을 맵핑하는 user_dept 테이블이 존재할 때, Entity의 객체 연관관계를 맵핑하여 영속 상태의 entity를 만들어 보겠습니다. @Entity @Table(name = "user") @NoArgsConstructor(access = AccessLevel.PROTECTED) public class UserEntity { @Id @Column(name = "user_id", nullable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) private Long userId; @Column(length = 50, nullable = false) private String name; @Column(length = 50.. 2021. 6. 18.
[SpringBoot] Mybatis + JPA + QueryDsl 설정 https://moonsiri.tistory.com/53 기존에 설정해둔 DB Configuration에 설정을 추가하겠습니다 1. JPA 설정 pom.xml org.springframework.boot spring-boot-starter-data-jpa DatabaseConfig.java @Configuration @EnableJpaRepositories( basePackages = "com.moonsiri.**.repository", entityManagerFactoryRef = "entityManagerFactory", transactionManagerRef = "jpaTxManager" ) @MapperScan( basePackages = "com.moonsiri.**.dao", sqlSessio.. 2021. 6. 10.
728x90
반응형