实体类1
null does not have method open
实体类2
@Entity
@Table(name = "TICKETS")
public class Ticket {
....
@Column(name = "MERCHANT_NBR")
private String merchant_nbr;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "merchant_nbr", nullable = false)
private Merchant merchant;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name ="merchantNBR", nullable = false)
private merchantDetails merchantDetails;
错误地给出了...无效的列'merchantNBR'。但是我有一个名称的列。
@Entity
@Table(name="MERCHANT_DETAILS")
public class merchantDetails {
@Id
@Column(name="MERCHANT_NBR")
private String merchantNBR;
@OneToMany(fetch = FetchType.LAZY)
private Set<Ticket> ticket;
答案 0 :(得分:1)
所以它是一个连接列而不是列,为此您必须使用正确的注释来连接两个实体@JoinColumn
看到这可能会有所帮助
@joinColumn(name = "MERCHANT_NBR" ,referencedColumnName="merchantNBR")
private String merchant_nbr;
这里我认为您已经从
更改了权限类2中的列名@Column(name="MERCHANT_NBR") to `@Column(name="merchantNBR")`