實體類1com.microsoft.sqlserver.jdbc.SQLServerException:無效的列名 'XXX'
@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;
實體類2
@Entity
@Table(name="MERCHANT_DETAILS")
public class merchantDetails {
@Id
@Column(name="MERCHANT_NBR")
private String merchantNBR;
@OneToMany(fetch = FetchType.LAZY)
private Set<Ticket> ticket;
錯誤的捐贈......無效列 'merchantNBR'但我有這個名字的專欄。
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name 'merchantNBR'.
列名稱爲MERCHANT_NBR,而不是merchantNBR,因爲它在您的休眠註釋中顯示 – PacMan
感謝您的回覆。當我改變它時,它給出了這個: 「實體映射中的重複列:com.triton.model.Ticket列:merchant_nbr」。不休眠允許映射到一列中的兩個不同的表? – Rishi
您是否在使用該列連接兩個實體 – PacMan