Giter Club home page Giter Club logo

Comments (2)

LoveAndCode avatar LoveAndCode commented on July 22, 2024

좋은 포스팅을 올려주셔서 감사합니다. 항상 많은 도움이 되고 있습니다!

한 가지 궁금한점이 있는데요.
*.sql 파일로 테스트 데이터를 set up 하고, ddl-auto를 none으로 설정한 상태에서 엔티티 클래스에 변경이 있는 경우 (컬럼 명 변경, 컬럼 사이즈 변경 등등), *.sql 파일들을 모두 찾아서 수정을 해줘야 할 것 같은데 이러한 경우, 수기로 변경하는 것 이외에 좋은 방법이 있을까요?

엔티티 변경이 테스트 코드 상에는 반영되었지만 *.sql 파일에는 반영이 되지 않아 테스트가 몇 번 실패한 적이 있어서 현재는 Entity Manager를 통해 set up을 하고 있습니다..😂

사족으로는

데이터 Set Up은 Entity Manager를 이용해서 사용하는 것이 훨씬 효율 작이라고 생각이 드실 겁니다

이 부분에 오타가 있는 것 같습니다~!

from blog-comment.

cheese10yun avatar cheese10yun commented on July 22, 2024

결론 부터 말씀드리면 좋은 대안은 없습니다.

개인적으로는 테스트 코드에서는 ddl-auto를 none으로하지 않고 사용합니다. 대부분의 테스트 대역에서는 EntityManager 기반으로 given을 작성하는것을 권장합니다.

*.sql 기반으로 셋팅하는 경우는 다음과 같습니다.

  1. spring batch test
  2. 서비스의 디비가 아닌 경우 (어쩔수 없이 DataSource를 2개이상 무는 구조)
  3. Entity Manager를 생성 하지 않은 구조 (2번과 유사)
  4. 특정 시점의 데이터로 set up 필요한경우 (setter가 닫혀 있어 로직으로 구현이 불편한 경우)

1~4에 해당하지 않으면 EntityManager 기반으로 작성하는것이 좋을거 같습니다.

from blog-comment.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.