콘텐츠로 이동

2021 08 01

2021-08-01

LOB(Large Object)

  • 참고: https://stepping.tistory.com/30
  • LOB: 텍스트, 그래픽, 이미지, 비디오, 사운드 등 구조화 되지 않은 대형 데이터 저장에 사용 - CLOB: 문자 대형 객체 (보통 4000자를 넘어가는 경우) - BLOB: 이진 대형 객체 - NCLOB: 내셔널 문자 대형 객체 - BFILE: OS에 저장되는 이진 파일의 이름과 위치를 저장

TEXT vs VARCHAR

Service 테스트에 @Transactional 붙는 이유?

  • EntityManager를 사용하여 flush(), clear()를 사용한다 - 만약 transaction이 없는 상태에서 해당 메서드를 호출하면 다음과 같은 에러 No EntityManager with actual transaction available for current thread - cannot reliably process 'flush' call
  • 또한 객체를 조회하고 가져와서 테스트 코드에서 그 안의 내용물이 같은지 검사 - Lazy Loading의 경우 프록시만을 반환함 - 트랜잭션 끊겨서 그 안의 내용물 쿼리날려 가져올 방법이 없음
    failed to lazily initialize a collection of role: com.wooteco.nolto.feed.domain.Feed.feedTechs, could not initialize proxy - no Session
    org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.wooteco.nolto.feed.domain.Feed.feedTechs, could not initialize proxy - no Session
        at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:606)
        at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:218)
        at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:585)
        at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:149)
        at org.hibernate.collection.internal.PersistentBag.iterator(PersistentBag.java:387)
        at java.util.Spliterators$IteratorSpliterator.estimateSize(Spliterators.java:1821)