我正在寻找使用 java 添加、编辑、删除和删除 XML 数据库中的条目。下面的代码包含我的 XML 数据库中条目的所有 getter 和 setter。如何从我的 XML 中获取值到适当的对象中?
public class contact implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column
private int Id;
@Column
private String firstname;
@Column
private String lastname;
@Column
private String email;
public int getId() {
return Id;
}
public void setId(int Id) {
this.Id = Id;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public contact(int Id, String firstname, String lastname, String email) {
this.Id = Id;
this.firstname = firstname;
this.lastname = lastname;
this.email = email;
}