org.hibernate.MappingException: Repeated column in mapping for entity: Invoice column: INVOICE_ID -


hibernate saying mapping column invoice_id repeated. unable understand exception. please !! invoice class given below :

    @entity     @table(name="invoices")     public class invoice {          @id         @generatedvalue(strategy=generationtype.auto)         @column(name="invoice_id", nullable=false,insertable=false,updatable=false)         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;          @onetoone         @joincolumn(name="invoice_item_detail_id", nullable=false)         private invoiceitemsdetails invoiceitemsdetails;          @onetoone         @joincolumn(name="id", nullable=false)         private client client;           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;         }       /*  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;         }           public invoiceitemsdetails getinvoiceitemsdetails() {             return invoiceitemsdetails;         }          public void setinvoiceitemsdetails(invoiceitemsdetails invoiceitemsdetails) {             this.invoiceitemsdetails = invoiceitemsdetails;         }         } 

i have used invoice_id foreign key in users table given below :

@onetomany     @joincolumn(name="invoice_id", nullable=false)     public set<invoice> getinvoices() {         return invoices;     } 

this mapping makes no sense me.

how invoice_id column of table invoice (which primary key) serve foreign key user.id column?

there should user_id column in invoice, , column should serve joincolumn onetomany association:

@onetomany @joincolumn(name="user_id", nullable=false) public set<invoice> getinvoices() {     return invoices; } 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

php - HTTP_REFERER woes: How can I allow access to a specific page, only when a visitor has visited another specific page beforehand? -

java Extracting Zip file -