I understood, I think, that a \"Bean\" is a Java class with properties and getters/setters. As much as I understand, it is the equivalent of a C struct. Is that true?
<
Properties of JavaBeans
A JavaBean is a Java object that satisfies certain programming conventions:
The JavaBean class must implement either Serializable
or
Externalizable
The JavaBean class must have a no-arg constructor
All JavaBean properties must have public setter and getter methods
All JavaBean instance variables should be private
Example of JavaBeans
@Entity
public class Employee implements Serializable{
@Id
private int id;
private String name;
private int salary;
public Employee() {}
public Employee(String name, int salary) {
this.name = name;
this.salary = salary;
}
public int getId() {
return id;
}
public void setId( int id ) {
this.id = id;
}
public String getName() {
return name;
}
public void setName( String name ) {
this.name = name;
}
public int getSalary() {
return salary;
}
public void setSalary( int salary ) {
this.salary = salary;
}
}