chaitu chaitu
asked on
how do i create -.hbm.xml file by looking java bean
i am integrating spring with hibernate;i dont know hibernate;this is my employee class;;by seeing the class how can i create Emplee.hbm.xml file;
here for id i created sequence i.e emp_seq.nextval;
public class Employee implements Serializable {
private int id;
private String name;
private String address;
private String email;
private String phone;
public Employee()
{
}
public Employee(int id,String name,String addr,String email,String phone) {
this.id=id;
this.name=name;
this.address=addr;
this.email=email;
this.phone=phone;
}
public void setId(int id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setAddress(String address) {
this.address = address;
}
public void setEmail(String email) {
this.email = email;
}
public void setPhone(String phone) {
this.phone = phone;
}
// @Id (generate = GeneratorType.AUTO)
public int getId() {
return id;
}
// @Column (length=100)
public String getName() {
return name;
}
// @Column (length=100)
public String getAddress() {
return address;
}
// @Column (length=30)
public String getEmail() {
return email;
}
// @Column (length=15)
public String getPhone() {
return phone;
}
public String toString()
{
return "emp="+this.id+"...name="+ this.name+ ".addess=" +this.addr ess+"...em ail.."+thi s.email+". ...phone== "+this.pho ne;
}
}
here for id i created sequence i.e emp_seq.nextval;
public class Employee implements Serializable {
private int id;
private String name;
private String address;
private String email;
private String phone;
public Employee()
{
}
public Employee(int id,String name,String addr,String email,String phone) {
this.id=id;
this.name=name;
this.address=addr;
this.email=email;
this.phone=phone;
}
public void setId(int id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setAddress(String address) {
this.address = address;
}
public void setEmail(String email) {
this.email = email;
}
public void setPhone(String phone) {
this.phone = phone;
}
// @Id (generate = GeneratorType.AUTO)
public int getId() {
return id;
}
// @Column (length=100)
public String getName() {
return name;
}
// @Column (length=100)
public String getAddress() {
return address;
}
// @Column (length=30)
public String getEmail() {
return email;
}
// @Column (length=15)
public String getPhone() {
return phone;
}
public String toString()
{
return "emp="+this.id+"...name="+
}
}
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
hows that related to the question?
ASKER
anyway i solved that problem i thought u may be knowing that ;
any other approach other tahn xdoclet.
any other approach other tahn xdoclet.
hibernate looks after constructing the query
ASKER
using hibernateDAOSupport class i am retrving emp records
getHibernateTemplate().fin
my doubt is where does "select part" will come in the query ??