백엔드/Spring132 [spring] postgresql 이름의 릴레이션(relation)이 없습니다 db안에 테이블이 없어서 생기는 오류이다. db연결은 되었는데 테이블 이름이 없다고 연결되지 않아 페이지가 로드가 되지 않았다. 처음 작성할 때는 테이블 안에 @Table(name="") 에서 name만 정의했었는데 schema까지 정의해서 작성해주어야 한다. > ApiInfoEntity > application.properties source.url=jdbc:postgresql://localhost/postgres 2021. 5. 13. Unknown column '' in 'field list' on MySQL error 다음과 같은 에러가 나는데는 3가지 경우가 있다. 1. column이 없어서 그런경우 2. 문자열로 준 데이터가 더블 쿼테이션으로 둘러싸여 있지 않은 경우 (문자열로 인식 못해서) ${test} 를 #{test} 로 변경 3. dto나 service에서 호출을 못하는 경우 나의 경우 2번에 해당하는 에러로 ${test} 를 #{test} 로 변경해주었더니 해결되었다. 2021. 5. 4. Table 'DB_NAME.hibernate_sequence' doesn't exist 방법1. Table 'DB_NAME.hibernate_sequence' doesn't exist 의 오류가 나오면 다음 내용을 추가 spring.jpa.hibernate.use-new-id-generator-mappings=false 방법 2 @Id //@GeneratedValue(strategy= GenerationType.SEQUENCE) @GeneratedValue(strategy= GenerationType.IDENTITY) private Integer id; SEQUENCE 대신 IDENTITY를 사용한다 2021. 4. 28. [spring] application.properties 의 datasource 설정하기(port, db) - DB연결하기 포트번호 변경 server.port=8082 데이터베이스 연결 # Database #driver-class-name 은 사용하고자 하는 데이터베이스로 #spring.datasource.driver-class-name=org.mariadb.jdbc.Driver spring.datasource.driverClassName=org.mariadb.jdbc.Driver #spring.datasource.url=데이터베이스 주소 spring.datasource.url=jdbc:mariadb://localhost:3306/gtck?characterEncoding=UTF-8&serverTimezone=UTC spring.datasource.username=아이디 spring.datasource.password=비밀번호.. 2021. 4. 27. JPA Auditing JAVA에서 JPA를 사용하여 도메인을 관계형 데이터베이스 테이블에 매핑할 때 공통적으로 도메인들이 가지고 있는 필드나 컬럼들이 존재한다. 데이터베이스에서는 누가, 언제 하였는지 기록을 잘 남겨놓아야 하기 때문에 생성일, 수정일 컬럼은 중요한 데이터이다. 그래서 JPA는 Audit이라는 기능을 제공하고있다. Audir은 감시하다, 감사하다 라는 뜻으로 Spring Data JPA에서 시간에 대해서 자동으로 값을 넣어주는 기능이다. 도메인을 영속성 컨텍스트에 저장하거나 조회를 수행한 후에 update를 하는 경우 매번 시간 데이터를 입력하여 주어야 하는데 audit을 이용하면 자동으로 시간을 매핑하여 데이터베이스의 테이블에 넣어주게 된다. JPA는 Application의 Entity와 DB의 Table을 .. 2021. 4. 22. Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. 다음과 같은 오류를 만나면 DB 정보가 입력되지 않아 생기는 오류이므로 application.properties 에 아래 코드를 입력해주면 된다. spring.datasource.driver-class-name=org.mariadb.jdbc.Driver spring.datasource.url=jdbc:mariadb://localhost:3306/database이름?characterEncoding=UTF-8&serverTimezone=UTC spring.datasource.username= spring.datasource.password= 2021. 4. 22. 이전 1 ··· 16 17 18 19 20 21 22 다음