Code Monkey home page Code Monkey logo

til's Introduction

til's People

Contributors

nhkiiim avatar

til's Issues

RN : npm run android

RN 프로젝트 실행 시 발생

$ npm run android
This is probably not a problem with npm. There is likely additional logging output above.

RN : cli.init is not a function

react native 프로젝트 생성 시 발생

$ npx react-native init [프로젝트명]
TypeError: cli.init is not a function

DB 세션 확인 및 kill (Oracle)

배치 테스트를 진행하다 여러번 실행시켜 내가 CPU를 다 잡아먹고 있는 상태 발생..! 어플리케이션을 종료해도 끊기지 않았기 때문에 우선 session kill 하기로 결정..

@Data 와 extends 사용 시 컴파일 경고

CommDto를 만들어 DTO에서 상속 받고 @Data를 사용하는 경우 경고 발생

다른 클래스를 확장하는 클래스에 @Data 적용 시 @EqualsAndHashCode로 인해 컴파일 경고 발생

Generating equals/hashCode implementation but without a call to superclass, even though this class does not extend java.lang.Object. If this is intentional, add '@EqualsAndHashCode(callSuper=false)' to your type.

iframe parent redirection

iframe으로 tab을 구현한 상황에서 권한이 없거나 인증이 만료되었을 때 스프링 시큐리티를 통해 로그인 페이지로 리디렉트 되는데,
iframe 내부에서 로그인 페이지로 이동하는 상황 발생 (화면 중첩)

자바 동적 SQL 생성 MyBatis로 전환하기

자바에서 PreparedStatement 인터페이스를 활용해 동적 SQL을 생성하는 것을 MyBatis로 변환 필요한 상황

기존 자바 코드의 다이나믹 쿼리 생성을 위한 조건문 예시

if (listDto.getDtoList().size() > 0 ) {	            	
    
    if( ... 조건  ) {
        query.append(" and CD = ");
        query.append(listDto.getDtoList(0).getCd());
    }
    
    if ( ... 조건 ) {
        query.append(" and YN = ");
        query.append(listDto.getDtoList(0).getYn());
    } else {
        query.append(" and YN = '0' ");	            		
    }

	
} else {
    query.append(" and YN = '0'");
}

DTO 예시 (조건에 필요한 DTO가 리스트 형태로 전달 됨 - 비교에 필요한 객체는 하나 뿐 (0번 인덱스))
구조 전환 작업이기 때문에 입출력 형태 변경 불가

@Data
public class ListDto extends BaseDto {

    private List<Dto> dtoList;
    ...

}

PostgreSQL : ON CONFLICT 구문과 Sequence 함께 사용하기

PostgreSQL에서 ON CONFLICT 구문 사용 시 시퀀스를 함께 사용하면 conflict 조건을 확인을 위해 시퀀스 값을 입력하게 되고,
자동으로 시퀀스를 생성해주는 INSERT인 경우 NULL 값이 들어가며 NOT NULL 제약조건을 위반

INSERT INTO 테이블 (  TEST_ID, TEST_NM  ) VALUES 
( 5, 'name' ) ON CONFLICT ( TEST_ID ),
( NULL, 'name' ) ON CONFLICT ( TEST_ID )
DO UPDATE SET 
TEST_NM = 'name'

PostgreSQL SERIAL : #101

스택오버플로 관련 이슈

eclipse : 멀티 모듈 프로젝트 import 시 .project 파일 부재 이슈

멀티 모듈 프로젝트 import 중 .project 파일이 각각 존재하지 않아 인식이 안되는 경우 발생

.project 파일의 경우 이클립스에서 사용하는 프로젝트 디스크립션 파일으로 이클립스에서 프로젝트로 인식하기 위해 필요하다.
다만 다른 IDE를 사용할 경우 필요 없는 파일이기 때문에 .gitignore로 무시되는 경우가 있어 주의해야함!!

스프링 순환 참조 문제

프로프레임 ➡️ 스프링부트로 전환하는 프로젝트 진행 중 순환참조 문제 발생

@RequiredArgsConstructor를 활용한 생성자 주입으로 의존성 주입

  • 서비스1 메서드A -> 서비스2 메서드B 호출
  • 서비스2 메서드C -> 서비스3 메서드D 호출
  • 서비스3 메서드E -> 서비스1 메서드F 호출

  • 메서드의 순환 호출은 없는 상황으로 AS-IS 에서는 오류 X
  • TO-BE 에서 스프링으로 전환하며 빈을 등록해 사용하며 순환 참조 발생 !

INSERT 이후 auto increment Key 값 가져오기

auto increment되는 시퀀스를 가져와 저장해야 하는 경우 (두개의 테이블에 같은 키값으로 저장, 이미지 저장 후 게시글 저장)
MyBatis useGeneratedKeys를 통해 INSERT 이후 auto increment Key 값 가져오려 했으나 오류 발생

개념 관련 discussion #112

<insert id="save" useGeneratedKeys="true" keyProperty="[VO 변수명]"
            parameterType="... Vo$Test">
nested exception is org.apache.ibatis.executor.ExecutorException: 
Error getting generated key or setting result to parameter object. 
Cause: org.apache.ibatis.executor.result.ResultMapException: 
Error attempting to get column #1 from result set. 
Cause: org.postgresql.util.PSQLException: Bad value for type long : PJT00012

상속 관계에서 @Builder 사용하기 - @SuperBuilder

Dto에서 BaseDto를 extends 한 상황에서, @Builder를 사용해 빌더 패턴으로 BaseDto의 필드 설정 시 컴파일 오류 발생

BaseDto (부모클래스)

@Data
public class BaseDto {

    private Long seq;
    private Long size;
    ...

}

Dto

@Data
@Builder
@EqualsAndHashCode(callSuper = true)
public class Dto extends BaseDto {

    private List<...> dtoList;
    ...

}
return Dto.builder()
  .dtoList(mapper.select(...))
  .seq(...) // 오류 발생 !!
  .build();

Enum 타입 Mybatis에서 사용하기

Mybatis enum 타입을 분기를 위한 조건문에 사용 시 에러 발생 (당근,, Enum 타입이니까,, ㅠㅁㅜ )

<insert id="updateUser" parameterType="...">
    UPDATE USER
    SET USER_STT = #{userStt}
    <if test="role == 'ROLE_GUEST' and userStt != '03'">
        ROLE = #{role}
    </if>
    WHERE USER_ID = #{userId}
</insert>

Spring Boot Validation Starter 라이브러리 추가 오류

spring-boot-starter-validation 라이브러리 추가 후 build.gradle 을 refresh 했음에도
@NotBlank와 같은 org.hibernate.validator (spring-boot-starter-validation안에 포함)의 클래스를 import 할 수 없는 상황 발생

// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation
implementation 'org.springframework.boot:spring-boot-starter-validation:3.0.5'

PreparedStatement addBatch() / MyBatis foreach

PreparedStatement addBatch() / MyBatis foreach

프로프레임 -> 스프링 전환 사전 분석 과정에서 addBath(), executeBatch()를 마이바티스 Mapper 인터페이스로 변환하면서 마이바티스의 foreach 사용

처리량이 많아 addBath()후 나누어서 executeBatch()를 수행하는 상황은 아니었고, 한번의 executeBatch()만 수행, 자세한 데이터 처리량 확인 필요

관련 개념 #109

@Builder와 @RequestBody

@Builder 사용 시 발생, builder() 사용 시 괜찮다가 @RequestBody 사용 시 발생

Cannot construct instance of `[Class Reference]` (no Creators, like default constructor, exist): 
cannot deserialize from Object value (no delegate- or property-based Creator)

Spring Security 종속성 관리

로컬 서버에서는 스프링 시큐리티 적용이 너무 잘 되는데!!! 개발 서버만 가면 오류 발생

java.lang.NoClassDefFoundError: org/springframework/security/config/annotation/web/builders/HttpSecurity

DB : 컬럼 추가 시 순서 변경

컬럼 추가 시 순서 변경

처음 테이블 구조를 유지하는 것이 가장 좋겠지만, 추가 요구사항 발생으로 개발 도중 테이블에 컬럼을 추가해야하는 상황 발생!
컬럼 추가 시 테이블의 마지막에 추가되는데 컬럼 순서를 바꾸고 싶을 때 DBMS별 다른 방식으로 변경 가능

테이블을 새로 생성해 순서를 변경하려는 경우 코멘트나 권한들이 사라지거나
제약 조건에 문제가 발생할 수 있으므로 꼭 필요할 때에만 변경하기

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.