Samuel,
This
pattern is called as Value Object, Example is as follows
public class EmployeeVO
{
private
String name;
private String employeeid;
public void setName(String name)
{
this.name=name;
}
public String getName()
{
return name;
}
public void setEmployeeID(String employeeid)
{
this.employeeid=employeeid;
}
public String setEmployeeID()
{
return employeeid;
}
} // No main method is present here
Ideally you extract the data from a request object in the web tier, create a instance of the above EmployeeVO and assign the data using the setter methods and send the EmployeeVO object as the parameter to the Data Acess Tier.In Data Acess Tier its retrived using gettter methods.
Sameway when you retrive data from a database the same process is done and the EmployeeVO object is sent to the Web Tier
Dont write getter and setter methods in an
EJB, its a costly deal !
This pattern is also out dated ... you can use Transfer Object, Its quite the same except that it has only member variables (No getter & setter methods) would say its not encapsulated. For more details on this refer
www.corej2eepatterns.com Hope this helps.
- Senthil