The BusinessObject represents the data client. It is the object that requires access to the data source to obtain and store data. A BusinessObject may be implemented as a session bean, entity bean, or some other Java object, in addition to a servlet or helper bean that accesses the data source.
DataAccessObject
The DataAccessObject is the primary object of this pattern. The DataAccessObject abstracts the underlying data access implementation for the BusinessObject to enable transparent access to the data source. The BusinessObject also delegates data load and store operations to the DataAccessObject.
DataSource
This represents a data source implementation. A data source could be a database such as an RDBMS, OODBMS, XML repository, flat file system, and so forth. A data source can also be another system (legacy/mainframe), service (B2B service or credit card bureau), or some kind of repository (LDAP).
TransferObject
This represents a Transfer Object used as a data carrier. The DataAccessObject may use a Transfer Object to return data to the client. The DataAccessObject may also receive the data from the client in a Transfer Object to update the data in the data source.
What is exactly a Transfer Object and what is exactly a Business Object? Could you make a real life example to better clarify this doubt?
public class Customer implements java.io.Serializable {
// member variables
int CustomerNumber;
String name;
String streetAddress;
String city;
...
// getter and setter methods...
...
}
From that I assume the transfer object is the java bean which encapsule the DAO object by the setters and getters.
The business object: well, I think it's related a way more to J2EE than JSE7, however it could be simplisticly implemented in JSE with a normal java class flow controlling the various transfer objects in order to interact with the database, in other words a way to interact with all the other participants.
Transfer object is a POJO that captures just the data of your entity. It has no business logic i.e. it doesn't understand what that data means and can't do anything with that data. So, it usually just has getters and setters.
Business Object contains the actual business logic of the application. For example, you might have a class named AccountManager, that has a method createAccount that takes an Account object. So createAccount is a business method , Account is a VO/DTO. Futher, AccountManager could use a class named AccountDAO, which knows how to save this Account object to the database.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.