DAO pattern in java what is a Business Object
Business objects are objects that concentrate all the logic of your application. Use Business Objects to separate business data and logic using an object model.
SEE HERE
The DAO is responsible for getting a business object in a storage independent way. For example you can create a DAO for accessing a customer like
public interface CustomerDAO {
public Customer getCustomerById(Integer id)
}
and then implement a data access in jdbc
public class JdbcCustomerDao {
public Customer getCustomerById(Integer id){
DataSource dataSource ...;
Connection con = dataSource.getConnection(...);
}
}
or implement an CustomerDao that accesses a web service or whatelse. The advantage of the CustomerDao is that a client (the code that uses the CustomerDao) is independent of the concreate storage technology. That's why you should desing the DAO API without storage dependencies. A good hint is the import statements of the CustomerDAO interface. If the CustomerDAO import statements contain something like:
import javax.sql.***
you should re-think the design of your API. But keep in mind that you can also introduce API dependencies with strings. E.g.
public Customer findCustomer(String sqlWhereClause){
...
}
The business object holds the data an it is the place where you should put the domain logic at. If you are using a rich domain model approach.
For details see Concrete examples on why the 'Anemic Domain Model' is considered an anti-pattern