Thanks for your response,
Quote:
That belongs in business logic. If you have layers of business logic, it belongs in the lowest layer. If your DAO contains business logic code, that's a good place to put it. So your DAO might have a saveDomainModelInternal method that unconditionally saves the object (and thus throws an exception if the domain model already exists in the DB), a verifyDomainModelNotInDB method, and a saveDomainModel method like this
public void saveDomanModel(DomainModel md)
{
if (verifyDomainModelNotInDB(dm))
saveDomainModelInternal(dm);
}
Alternatively, you might choose to merge() or replicate() instead of save(), so that the in-memory domain model is written to the DB.
HIA also states that DAO should not contain any business logic routines, it should only contain data access routine.
Regards,
Setya