querydsl 적용(rebuild시 에러 발생하는것 fix)
parent
c3f2aa348f
commit
f7116730c4
@ -0,0 +1,57 @@
|
||||
package com.xit.biz.ctgy.repository;
|
||||
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import com.xit.biz.ctgy.entity.MinSimsa680;
|
||||
import com.xit.biz.ctgy.entity.QMinSimsa680;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import static com.xit.biz.ctgy.entity.QMinSimsa680.minSimsa680;
|
||||
|
||||
@SpringBootTest
|
||||
@Transactional
|
||||
@ActiveProfiles({"dev"})
|
||||
@Slf4j
|
||||
public class RepositoryTest {
|
||||
|
||||
@Autowired
|
||||
EntityManager em;
|
||||
|
||||
private JPAQueryFactory queryFactory;
|
||||
|
||||
// @BeforeAll
|
||||
// void beforeAll(){
|
||||
// log.debug("initializing...");
|
||||
// }
|
||||
|
||||
// @AfterAll
|
||||
// void afterAll(){
|
||||
// log.debug("...shutdown");
|
||||
// }
|
||||
|
||||
@BeforeEach
|
||||
void beforeEach(){
|
||||
log.debug("biz start...");
|
||||
queryFactory = new JPAQueryFactory(em);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void afterEach(){
|
||||
log.debug("... biz end");
|
||||
}
|
||||
|
||||
@Test
|
||||
void querydslTest() {
|
||||
//QMinSimsa680 qMinSimsa680 = new QMinSimsa680("minSimsa680");
|
||||
MinSimsa680 simsa680 = queryFactory.selectFrom(minSimsa680)
|
||||
.where(minSimsa680.msMaincode.eq(300297013L))
|
||||
.fetchOne();
|
||||
log.debug("##################################{}",simsa680);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue