We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

how do i create -.hbm.xml file by looking java bean

chaitu chaitu
on
Medium Priority
280 Views
Last Modified: 2010-08-05
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;
      }

}
Comment
Watch Question

Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
you need to add xdoclet annotations

http://www.hibernate.org/72.html

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

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 ??
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
hows that related to the question?

Author

Commented:
anyway i solved that problem i thought u may be knowing that ;



any other approach other tahn xdoclet.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
hibernate looks after constructing the query
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.