Link to home
Create AccountLog in
Avatar of chaitu chaitu
chaitu chaituFlag for India

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.address+"...email.."+this.email+"....phone=="+this.phone;
      }

}
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of chaitu chaitu

ASKER


using hibernateDAOSupport class  i am retrving emp records

getHibernateTemplate().find(" FROM EMP");


my doubt is where does "select part" will come in the query ??
hows that related to the question?
anyway i solved that problem i thought u may be knowing that ;



any other approach other tahn xdoclet.
hibernate looks after constructing the query