본문 바로가기

Programming!

JPA Lock - @Version 사용하기 기본적으로 @Version사용시 낙관적 락이 적용된다.(LockModeType.NONE) A 사용자가 [OrderId 1번 조회후 ProductId를 10으로 변경] B 사용자가 [OrderId 1번 조회후 ProductId를 5으로 변경] 먼저 A사용자가 ProductId의 변경을 시도하지만 이런저런 이슈로 하나의 TX가 15초 걸린다고 가정하고,(http://localhost:8080/orders/1/products/10/update-tx-lock?ms=15000) 이후 B사용자는 걸림없이 ProductId를 5로 수정했다.(http://localhost:8080/orders/1/products/5/update-tx-lock?ms=0) 이경우 A사용자는 먼저 find가 실행되어 해당 Version을 .. 더보기
Spring Data JPA에서 new XXX() 사용하기. SpringDataJPA-Tips @Query Annotation 등으로 특정 컬럼만 호출하도록 한다. findById와 같이 일반적인 select에서는 해당 entity의 모든속성을 호출하게 되어있다. 이경우 불필요한 컬럼과 자식entity까지 가져오게 되므로 아래와 같이 처리하는게 좋을 수도 있다. (기본적인 Projections 관련 사항은 꼭 둘러보자) 기존 findById(id) Hibernate: select company0_.id as id1_0_0_, company0_.createdAt as createdA2_0_0_, company0_.createdBy as createdB3_0_0_, company0_.modifiedAt as modified4_0_0_, company0_.modifie.. 더보기
Jenkins Api Launcher 가볍게 만들어 보기 - Spring Boot - Local Jenkins https://github.com/eclipse4j/jenkins-api-launcher - Local Jenkins 설치 후, "jenkins-launcher-exsample_00" Job을 만든다. - 구성으로 들어가서 빌드를 원격으로 유발에 체크. - 그외 매개변수나 시큐리티 설정을 해주면된다. - github에서 소스를 받고 아래 테스트 코드를 실행해 보자. JenkinsLauncherServiceTest.java - 아래 처럼 실행 로그가 남으면 성공. 더보기
PERFORMANCE WARNING: Overlapping onDeckSearchers=2 Solr Warnning 중 아래의 내용이 출력되는 경우.(기본적인 warn은 commit의 빈도가 많기 때문이다.) "PERFORMANCE WARNING: Overlapping onDeckSearchers=2" 위 문제를 해결하기 위해 maxWarmingSearchers의 숫자를 늘리지는 말자.(물론 필요시 늘릴 수 있음.) - Application 직접 작성한 소스내 commit()을 호출하는 부분이 있다면 삭제한다. - autoCommit과 maxTime, softAutoCommit을 적절하게 조절한다. 해당 처리후 서버를 재기동 하면 오류가 출력되지 않음을 확인했다. ex) 1000000 30000 5000 false 3000 ${solr.solr.home:}/data 더보기
Spring ( boot ) 에서 @EnableXXX 설정 활성화 만들기 https://github.com/eclipse4j/spring-enableXX ### 기본 생성시 @SpringBootApplicationpublic class StudySpringEnableAnnotationApplication { public static void main(String[] args) {SpringApplication.run(StudySpringEnableAnnotationApplication.class, args);}} ### Enable Annotation 만들기 @Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)public @interface EnableRestTemplate {} ### Spring RestTemplate.. 더보기