본문 바로가기

개발44

[Spring Data Jpa] Native query DTO Projection 1. Interface dto로 Projection - DTO public interface InterfaceDTO { // 규칙에 맞게 메소드 정의 (필드처럼 사용 가능) int getTableId(); String getName(); String getBrand(); } - JPA Repository (Pageable이 필요하다는 가정) Pageable로 페이징 가능, Pageable에 정의된 Sort방식 적용 가능!! (1) Page 객체로 받을 때 : countQuery 속성 꼭 필요!! interface dto가 가지고 있는 필드 명에 맞게 alias를 정의하면 자동으로 매칭됨 @Query(value= "SELECT tn.id as tableId, tn.name as name, tn.brand .. 2021. 7. 25.
[erwin] forward engineering Forward engineering 이란? "Forward engineering is the process of building from a high-level model or concept to build in complexities and lower-level details." "복잡한 하위 레벨의 디테일을 구축하기 위해 상위 모델을 만드는 작업" erwin의 경우로 생각해보면, erwin에서 생성한 Entity들을 sql ddl 문으로 변경시키는 것이다. Reverse engineering 이란? "Forward engineering is thus related to the term 'reverse engineering,’ where there is an effort to build backward.. 2021. 7. 2.
[Java] clone()에 대해서 목차 - Shallow Copy과 Deep Copy란? - Shallow Cloning - Deep Cloning - ( 번외 ) 배열의 Clone 1. Shallow Copy과 Deep Copy란? Shallow Copy (얕은 복사) : 원본 객체를 복사하여 새롭게 생성하지만 원본 객체 내의 참조자료유형 변수는 원본 객체가 가지고 있는 객체 변수와 동일하다. (기본자료유형에 대해선 deepcopy가 이루어진다.) Deep Copy (깊은 복사) : 원복 객체를 복사하는 것 뿐만 아니라, 원본 객체 내의 객체 변수들 까지도 완벽히 복사된다. Shallow Copy 그림설명 Deep Copy 그림 설명 2. Shallow Copy Java에서 객체에 대한 Clone() 메소드를 사용하려면 Clonable.. 2021. 5. 17.
[파이썬] Counter 모듈에 대해서 (list 요소별 개수 파악하기) collections.Counter 모듈에 대해서 알아보도록 하겠다. 1. Counter 모듈이란? 파이썬 list 에서 요소별 개수를 알고 싶을 때가 있을 것이다. 주로 중복값이 포함되어 있는 list에서 이러한 정보를 알고 싶은 경우가 많다. sample = ['a', 'b', 'b', 'c', 'd', 'a'] 위와 같은 list에서 'a'는 몇 개인지, 'b'는 몇 개인지에 대한 요소별 개수를 찾아주는 모듈이라고 생각하면 되겠다. 2. Counter 선언법 - 배열을 전달하기 sample = ['a', 'b', 'b', 'c', 'd', 'a'] counter = Counter(sample) print(counter) # 실행결과 Counter({'a': 2, 'b': 2, 'c': 1, 'd':.. 2021. 4. 3.