[TIL/JavaScript] script 태그, 이벤트, 문자열과 숫자
2023. 11. 20. 20:20
TIL/JavaScript
JavaScript와 html의 차이- htmld은 영원히 1+1 이라는 문자열이 출력되지만- JavaScript는 1+1을 계산한 2가 출력됨- 자바스크립트는 계산기처럼 작동할 수도 있는 다재다능한 녀석JavaScripthtml1+1 // 문자열 그대로 1+1이 출력 됨IntelliJ에서 ![TAB] 을 하면 HTML 템플릿을 자동으로 완성해준다.이벤트- 웹 브라우저 위에서 일어나는는 것을 사건, 즉 이벤트라고 함onclick 속성의 속성값은 브라우저가 기억하고 있다가, onclick의 속성이 위치하고 있는 태그를 사용자가 클릭했을 때, 기억하고 있었던 JS 코드를 JS 문법에 따라 해석해서 거기 적혀있는대로 브라우저가 작동함- 위 코드에서는 alert(`hi`) 코드를 브라우저가 기억하고 있다가 실제..
[TIL/Java] JPA - ddl-auto 주의점
2023. 11. 14. 23:55
TIL/Java
spring.jpa.hibernate.ddl-auto: create 옵션은 로컬 환경에서만 사용하기 create 옵션은 해당하는 테이블이 있으면 DROP 하고 새로 만듦 ddl-auto 옵션 종류 create: 기존 테이블 삭제 후 다시 생성 (DROP + CREATE) create-drop: create와 같으나 종료 시점에 테이블 DROP update: 변경분만 반영 (운영 DB에서 사용 X) validate: 엔티티와 테이블이 정상 매핑되었는지만 확인 none: 사용하지 않음
[TIL/Java] JPA - 어노테이션 정리
2023. 11. 14. 23:23
TIL/Java
@Getter Getter 메소드 생성 Setter는 되도록 사용 X -> 데이터가 변경되어 어느 지점에서 변경되는지 추적하기 힘듦 엔티티를 변경해야 할 일이 있으면 비즈니스 메소드 만들어서 사용하기 @Entity JPA를 사용해서 테이블과 매핑할 클래스는 해당 어노테이션 사용 필수 엔티티와 테이블명 다르게 하고싶을 때는 @Table @Builder 빌더 패턴 자동으로 생성 builder(): 빌더 클래스의 인스턴스 생성 build(): 실제 생성자 호출하여 객체 생성 빌더 패턴은 생성자에 인자가 많을 때 사용하면 편함 @DynamicUpdate 실제 값이 변경된 컬럼으로만 UPDATE 쿼리를 만듦 @AllArgsConstructor 클레스의 모든 필드에 대한 생성자를 자동으로 만듦 @Builder와 @..
[TIL/Java] Mooc.fi - Part 4 Introduction to object-oriented programming (Room까지 함)
2023. 11. 11. 17:58
TIL/Java
생성자는 인스턴스 변수 다음에 정의 됨 생성자의 이름은 클래스 이름과 항상 동일함 this.age = 0 이라는 예시가 있다고 한다면, 인스턴스의 age, 즉 this 개체의 age를 0으로 설정함 클래스 다이어그램에서 - 가 붙으면 private +가 붙으면 public