Reputation: 895
We're using Spring Boot + Hibernate, one of our classes has joined column with FetchType.EAGER. We would like to disable the fetch (simply return empty for that column), but after commenting out ElementCollection and CollectionTable, I cannot compile with the following error:
//@ElementCollection(fetch = FetchType.EAGER)
//@CollectionTable(name = "gsf_locate_request_pth", joinColumns = {@JoinColumn(name = "locate_id")})
@Column(name = "pth_ref")
private Set<Long> payToHoldRefs;
Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Set, at table: gsf_locate_request, for columns: [org.hibernate.mapping.Column(pth_ref)]
Upvotes: 0
Views: 159
Reputation: 19976
Annotation @Column(name = "pth_ref")
for simple types like String
only. Hibernate try to put Set<Long>
in one table column. It is impossible, of course. Just use FetchType.LAZY
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "gsf_locate_request_pth", joinColumns = {@JoinColumn(name = "locate_id")})
private Set<Long> payToHoldRefs;
Upvotes: 1