//here is the hibernate class which creates the
table called ‘Student’ in eclipse.
/*All variables are private whereas method are
public. This is to ensure that data cannot be accessed by other class, whereas
these method can be used in other class as they care public*/
import javax.persistence.*;
@Entity
public class Student {
@Id
@Column(name="RollNo")
private int rid;
@Column
private String fname;
@Column
private String lname;
@Column
private String dob;
@Column
private String gender;
public int getRid() {
return rid;
}
public void setRid(int rid) {
this.rid = rid;
}
public String getFname() {
return fname;
}
public void setFname(String fname) {
this.fname = fname;
}
public String getLname() {
return lname;
}
public void setLname(String lname) {
this.lname = lname;
}
public String getDob() {
return dob;
}
public void setDob(String dob) {
this.dob = dob;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
}
Inserting into database, following screenshot
Created by Ankita Bamania, edited by Dr. Ashwin I Mehta
For more details contact Vissicomp Technology 9320957717/718
0 comments:
Post a Comment