Example of Hibernate



Create the class

Create a new class named ?Honey? in the package ?de.laliluna.example?. Add three fields id, name and taste and generate (Context menu -> Source -> Generate Getter and Setter) or type the getters and setters for the fields. Then create an empty constructor.


package de.laliluna.example;

/**
* @author …………..
*
*/
public class Honey {
private Integer id;
private String name;
private String taste;

public Honey(){

}

/**
* @return Returns the id.
*/
public Integer getId() {
return id;
}
/**
* @param id The id to set.
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return Returns the name.
*/
public String getName() {
return name;
}
/**
* @param name The name to set.
*/
public void setName(String name) {
this.name = name;
}
/**
* @return Returns the taste.
*/
public String getTaste() {
return taste;
}
/**
* @param taste The taste to set.
*/
public void setTaste(String taste) {
this.taste = taste;
}
}

Share with SociBook.com

Random Posts

Sorry, comments for this entry are closed at this time.