onetomany非主键关联报错
Caused by: org.hibernate.MappingException: Unable to find column with logical name: position_id in org.hibernate.mapping.Table(user) and its related supertables and secondary tables
@JsonIgnore
@OneToMany(fetch = FetchType.LAZY)
@JoinColumn(name ="position_id", referencedColumnName = "position_id")
private List<PositonPositionAppAuthDto> positions;
@Entity
@Table(name = "position_position_app_auth")
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class PositonPositionAppAuthDto implements Serializable {
@Id
private Integer id;
private Integer position_id;
private Integer position_app_auth_id;
}
此时需要声明postion_id
何时不需要声明, 何时不能声明