I can do it(Feat. DEV)

Could not determine type for:,at table:,for columns: ... 본문

개발자 모드/오류처리

Could not determine type for:,at table:,for columns: ...

까짓거 해보자 개발자 2022. 10. 26. 13:19
728x90

개인프로젝트 도메인 관련 설정 중 위와 같은 에러 메세지를 만났음.

 

※에러메세지
Could not determine type for: ex.. , at table: ex.., for columns: [org.hibernate.mapping.Column(ex..)]
(ex.. 은 개인마다 달라서 예시로 적었음)

갓글에 검색해보니 두 Entity 간의 관계가 기술되지 않아서 발생한 문제라고 함.

즉, 도메인 필드는 만들었지만 어노테이션을 설정하지 않았거나,

옳바르지 않은 매핑 관계를 설정했을 때 등 에러가 발생함.

 

필자의 코드를 살펴보니

    //article 도메인의 필드
    @Comment(value = "게시판아이디")
    @JoinColumn(name = "board_id")
    //@ManyToOne을 추가해야함!!!
    private Board board;
    //board 도메인 필드
    @Comment("게시글아이디")
    @OneToMany
    private List<Article> articles;

이런 식으로 설정되어 있었음.

board 도메인에서 일대다 매핑만 해놓고 article 도메인에서 다대일 매핑 설정을 안했던 것!!

@ManyToOne 설정을 추가 후 구동하니 에러 없이 잘 돌아가는 것을 확인함.

에러는 작은 실수에서 일어나는 것도 많다는데 이런 경우 인 듯..

다음부턴 좀 더 꼼꼼하게 설정을 해야겠음! 끝.

 

 

📢참조

https://devday.tistory.com/entry/Caused-by-orghibernateMappingException-Could-not-determine-type-for-comizeyetestdomainVipAddress-at-table-ServerGroup-for-columns-orghibernatemappingColumnvipAddress

 

Caused by: org.hibernate.MappingException: Could not determine type for: com.izeye.test.domain.VipAddress, at table: ServerGroup

스프링 (Spring) Data JPA에서 Entity 클래스 안에서 다른 Entity 클래스 타입의 맴버 변수 사용 시 다음과 같은 예외에 직면할 수 있다. Caused by: org.hibernate.MappingException: Could not determine type f..

devday.tistory.com

 

728x90