h2 database 연동 관련 문제
Test class, application.yml 첨부 드립니다!! 확인부탁드립니다ㅠㅠ spring: datasource: # url: jdbc:h2:tcp://localhost/~/querydsl username: sa password: driver-class-name: org.h2.Driver jpa: hibernate: ddl-auto: create properties: hibernate: # show_sql: true format_sql: true logging.level: org.hibernate.SQL: debug # org.hibernate.type: trace package study.querydsl; import com.querydsl.jpa.impl.JPAQueryFactory; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.Commit; import org.springframework.transaction.annotation.Transactional; import study.querydsl.entity.Hello; import study.querydsl.entity.QHello; import javax.persistence.EntityManager; import java.util.List; @SpringBootTest @Transactional class QuerydslApplicationTests { @Autowired EntityManager em; @Test void contextLoads() { Hello hello = new Hello(); em.persist(hello); JPAQueryFactory query = new JPAQueryFactory(em); QHello qHello = QHello.hello; //Querydsl Q타입 동작 확인 Hello result = query .selectFrom(qHello) .fetchOne(); Assertions.assertThat(result).isEqualTo(hello); //lombok 동작 확인 (hello.getId()) Assertions.assertThat(result.getId()).isEqualTo(hello.getId()); } }