yml에서는 ;을 붙이지 않는다.

taehoon·2023년 11월 20일

습관적으로 코드를 작성할 때 ;을 붙였더니
실행은 정상적으로 되는데 쿼리문이 출력되지 않아서
찾아보니 ;가 문제였다.

# DATABASE
spring:
  #H2
  h2:
    console:
      enabled: true
      path: /h2-console #콘솔 url
  datasource:
    url: jdbc:h2:~/local #내가 만든 db경로 + 이름
    driverClassName: org.h2.Driver
    username: sa
    password:
  #JPA
  jpa:
    hibernate:
      ddl-auto: update
    properties:
      hibernate:
        format_sql: true; #;은 yml에서 특별한 의미가 있어서 함부로 붙이면 안된다.
        show_sql: true;
        dialect: org.hibernate.dialect.H2Dialect
Hibernate: 
    select
        a1_0.id,
        a1_0.content,
        a1_0.create_date,
        q1_0.id,
        q1_0.content,
        q1_0.create_date,
        q1_0.subject 
    from
        answer a1_0 
    left join
        question q1_0 
            on q1_0.id=a1_0.question_id 
    where
        a1_0.id=?

;을 제거해주니 정상적으로 출력되었다.

profile
건강

0개의 댓글