Im using hibernate with annotations
My database is 'Oracle'
I want to know that is it possible to write a entity class like this :
*Table columns are different from this class field names.
Code:
@Entity
@Table(name="TRN_ODEROFSALE")
public class OrderOfSale implements Serializable {
private String name;
private int id;
@Column(name="broker_name")
public String getName(){
return name;
}
public void setName(String name){
this.name = name;
}
//this have no mapping for a particular column//
public int getId(){
return name;
}
public void setId(int id){
this.id= id;
}
}
Above class there is a mapping column for 'name' field.
But i dont want 'id' field to be inserted.
I did this, but it shows error like this.
'Caused by: java.sql.BatchUpdateException: ORA-00904: "ID": invalid identifier
'