최대 절전 모드를 사용할 수 없다는 문제가 있습니다. USERS 테이블에서 Set에 대한 유형을 판별하십시오. 일대 다 관계를 통해 테이블 INVOICES의 외래 키를 만들려고합니다. 한 명의 사용자가 많은 송장을 생성 할 수 있습니다. 내 User.java가 아래와 같습니다.org.hibernate.MappingException : java.util.Set, 테이블 : USERS, 열 : [org.hibernate.mapping.Column (invoices)]
@Entity
@Table(name="USERS")
public class User {
@Id
@Column(name="User_Id",nullable=false)
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer user_id;
@Column(name="NAME")
private String name;
@Column(name="Address")
private String address;
@Column(name="Designation")
private String designation;
private Set<Invoice> invoices;
/*@OneToMany
@JoinColumn(name="Rec_Invoice_ID", nullable=false)
private Set<RecurringInvoice> recurring_invoices;*/
USERS 테이블에서 외래 키로 INVOICE-ID를 사용하려고합니다. 나는 Hibernate: Annotation one-to-many (foreign-key)
@OneToMany
@JoinColumn(name="INVOICE_ID", nullable=false)
public Set<Invoice> getInvoices() {
return invoices;
}
public void setInvoices(Set<Invoice> invoices) {
this.invoices = invoices;
}
/* public Set<RecurringInvoice> getRecurring_invoices() {
return recurring_invoices;
}
public void setRecurring_invoices(Set<RecurringInvoice> recurring_invoices) {
this.recurring_invoices = recurring_invoices;
}
*/
// Getters and Setters
public Integer getUser_id() {
return user_id;
}
public void setUser_id(Integer user_id) {
this.user_id = user_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getDesignation() {
return designation;
}
public void setDesignation(String designation) {
this.designation = designation;
}
}
내 Invoice.java은 아래와 같습니다 여기에 주어진 지침에 따라입니다.
@Entity
@Table(name="INVOICES")
public class Invoice {
private Integer invoice_id;
@Column(name="Date_Created", nullable=false)
private Timestamp dateCreated;
@Column(name="DESCRIPTION")
private String description;
@Column(name="Total_Amount")
private Double totalAmount;
@Column(name="Tax_Amount")
private Double taxAmount;
@Column(name="Due_Date")
private Timestamp dueDate;
@Column(name="deleted")
private boolean deleted;
private InvoiceItemsDetails invoiceItemsDetails;
private Client client;
@OneToOne
@JoinColumn(name="ID", nullable=false)
public Client getClient() {
return client;
}
public void setClient(Client client) {
this.client = client;
}
public Date getDueDate() {
return dueDate;
}
public void setDueDate(Timestamp dueDate) {
this.dueDate = dueDate;
}
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="INVOICE_ID", nullable=false, insertable=false,updatable=false)
public Integer getInvoice_id() {
return invoice_id;
}
public void setInvoice_id(Integer invoice_id) {
this.invoice_id = invoice_id;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Timestamp dateCreated) {
this.dateCreated = dateCreated;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Double getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(Double totalAmount) {
this.totalAmount = totalAmount;
}
public Double getTaxAmount() {
return taxAmount;
}
public void setTaxAmount(Double taxAmount) {
this.taxAmount = taxAmount;
}
public boolean isDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
@OneToOne
@JoinColumn(name="Invoice_Item_Detail_id", nullable=false)
public InvoiceItemsDetails getInvoiceItemsDetails() {
return invoiceItemsDetails;
}
public void setInvoiceItemsDetails(InvoiceItemsDetails invoiceItemsDetails) {
this.invoiceItemsDetails = invoiceItemsDetails;
}
}
안녕하세요 orid, 나는 당신이 말한 것을 다했지만 지금은 새로운 예외 org.hibernate.MappingException 점점 오전 : 엔티티 매핑 반복 열을 : invoke_id' 필드가 같은 컬럼 이름으로도 매핑 되었기 때문입니다 :'@Column (name = "INVOICE_ID") : net.impetus.dto.Invoice 컬럼 : INVOICE_ID (insert = "false"update = "false"로 매핑되어야 함) – user2251798
"..."FK 열 이름을'@OneToMany @JoinColumn (name = "USER_ID", nullable = false)과 같이 변경합니다. 개인 설정 인보이스 : –
대단히 감사합니다. Orid – user2251798