OpenJPA는 org.apache.openjpa.persistence.PersistentCollection 어노테이션이 있는 콜렉션 속성에 대한
별도의 테이블을 작성합니다. EclipseLink에서도 동작이 동일하도록 하려면 JPA 스펙에 정의된 대로 이러한 어노테이션을
@ElementCollection 및 @Column 어노테이션으로 바꾸십시오. @PersistentCollection
어노테이션을 제거하고 @ElementCollection 및 @Column 어노테이션을 추가하지 않으면
EclipseLink는 해당 필드를 BLOB로 취급하고 엔티티 테이블에 해당 데이터에 대한 열을 작성하려고 시도합니다.
이 규칙은 org.apache.openjpa.persistence.PersistentCollection 어노테이션을 수동으로 마이그레이션할 수 있도록
이 어노테이션에 대해 스캔합니다.
이 어노테이션을 마이그레이션하려면 다음 단계를 수행하십시오.
@org.apache.openjpa.persistence.PersistentCollection 어노테이션을 다음으로 바꾸십시오.
@javax.persistence.ElementCollection @javax.persistence.Column(name="element")속성에 이미
@Column 어노테이션이 있는 경우 또 하나를 추가하거나 이름을 변경하지 마십시오.
예를 들어, 이 규칙은 다음 엔티티 클래스의 @PersistentCollection 어노테이션에 플래그를 지정합니다.
import javax.persistence.Entity; import javax.persistence.Id; import org.apache.openjpa.persistence.PersistentCollection; @Entity public class IntArrayEntity{ @Id private int id; @PersistentCollection private int[] arrayOfInts; } |
이 엔티티를 마이그레이션하려면 어노테이션을 바꾸고 int 배열을
Integer 오브젝트 목록(List<Integer>)으로 변경하십시오.
import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class IntArrayEntity{ @Id private int id; @ElementCollection @Column(name = "element") private List<Integer> arrayOfInts; } |
OpenJPA에서 EclipseLink로의 마이그레이션 문제 중 이러한 문제에 대해서는 OpenJPA에서 EclipseLink JPA로 마이그레이션: 확장 기능 안내서를 참조하십시오.