我有一门课:
import org.springframework.security.core.userdetails.UserDetails;
@Entity
@Table(name="t_user")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Data
public class User implements Serializable, UserDetails {
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return null;
}
..
}
但我有一个编译错误:
'Many To One' attribute type should not be a container
1条答案
按热度按时间rslzwgfq1#
@ManyToOne
应该注解字段而不是集合。对于集合字段,正确的注解是@OneToMany
.所以如果你有
那应该是