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

何时不需要声明, 何时不能声明

posted @ 2018-08-21 09:54  車輪の唄  阅读(14)  评论(0编辑  收藏  举报  来源