Suppose I have a table Students
which has columns varchar firstname
and varchar lastname
.
For some reason my Entity Class has fields with different names, say String fname
and String lname
.
So how does JPA correctly map the column with the field?
CodePudding user response:
You may use the @Column
annotation, e.g.
@Entity(name="Students")
public class Students {
@Column(name = "firstname")
private String fname;
@Column(name = "lastname")
private String lname;
}