• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

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;
      }

}
0
chaitu chaitu
Asked:
chaitu chaitu
  • 3
  • 2
1 Solution
 
objectsCommented:
you need to add xdoclet annotations

http://www.hibernate.org/72.html
0
 
chaitu chaituAuthor Commented:

using hibernateDAOSupport class  i am retrving emp records

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


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



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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now