문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
java:hibernate:test [2016/09/18 14:04] kwon37xi |
java:hibernate:test [2016/09/18 16:09] kwon37xi |
||
---|---|---|---|
줄 9: | 줄 9: | ||
* [[https:// | * [[https:// | ||
* 자기가 테스트하고자하는 버전의 Template을 다운로드하여 자신만의 프로젝트에 복사해 넣고 이미 만들어져 있는 테스트 케이스 파일을 수정해서 해본다. | * 자기가 테스트하고자하는 버전의 Template을 다운로드하여 자신만의 프로젝트에 복사해 넣고 이미 만들어져 있는 테스트 케이스 파일을 수정해서 해본다. | ||
+ | * '' | ||
* [[https:// | * [[https:// | ||
+ | |||
+ | ===== hibernate-testing 사용시 Jboss Logging 문제 ===== | ||
+ | hibernate-testing 사용시 아래와 같이 jboss logging에 문제가 생길 수 있다. | ||
+ | < | ||
+ | java.lang.NoSuchMethodError: | ||
+ | </ | ||
+ | |||
+ | 이 이유는 hibernate-testing이 의존하고 있는 '' | ||
+ | '' | ||
+ | |||
+ | <code groovy> | ||
+ | testCompile(group: | ||
+ | exclude group: ' | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== Hibernate 4.2 미만 Spock Spec 기본 뼈대 ===== | ||
+ | <code groovy> | ||
+ | /** | ||
+ | * Hibernate/ | ||
+ | */ | ||
+ | abstract class AbstractUserTypeSpec extends Specification { | ||
+ | |||
+ | Configuration configuration; | ||
+ | |||
+ | SessionFactory sf; | ||
+ | |||
+ | void setup() { | ||
+ | configuration = new Configuration(); | ||
+ | |||
+ | |||
+ | // configuration.addAnnotatedClass(ClassName) 형태로 @Entity들 추가 | ||
+ | |||
+ | configuration.setProperty(" | ||
+ | configuration.setProperty(" | ||
+ | configuration.setProperty(" | ||
+ | configuration.setProperty(" | ||
+ | configuration.setProperty(" | ||
+ | configuration.setProperty(" | ||
+ | configuration.setProperty(" | ||
+ | |||
+ | // hibernate 4.2.x 미만 의 ServiceRegistryBuilder 설정. | ||
+ | // 4.x 끼리도 버전마다 조금씩 달라질 수 있다. | ||
+ | def srBuilder = new ServiceRegistryBuilder().applySettings(configuration.getProperties()) | ||
+ | def serviceRegistry = srBuilder.buildServiceRegistry() | ||
+ | |||
+ | sf = configuration.buildSessionFactory(serviceRegistry); | ||
+ | } | ||
+ | |||
+ | void cleanup() { | ||
+ | sf.close() | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ |