I was just reading this article:

http://www.tutorialized.com/view/tutorial/Spring-MVC-Application-Architecture/11986

which I find great. It explains the layer architecture nicely and I was glad that the architecture I'm working with pretty much is what he describes.

But there's one thing, that I don't seem to get:

First: what exactly is business logic and what is it not? In the article he says (and he's not the only one), that business logic should go in the domain model. So an Account class should have an activate() method that knows how to activate an Account. In my understanding this would involve some persistence work probably. But the domain model should not have a dependency of DAOs. Only the service layer should know about DAOs.

So, is business logic just what a domain entity can do with itself? Like the activate()method would set the active property to true, plus set the dateActivated property to new Date() and then it's the service's task to first call account.activate()and second dao.saveAccount(account)? And what needs external dependencies goes to a service? That's what I did until now mostly.

public AccountServiceImpl implements AccountService
{
  private AccountDAO dao;
  private MailSender mailSender;

  public void activateAccount(Account account)
  {
     account.setActive(true);
     account.setDateActivated(new Date());
     dao.saveAccount(account);
     sendActivationEmail(account);
  }
  private void sendActivationEmail(Account account)
  {
    ...
  }
}

This is in contrast to what he says, I think, no?

What I also don't get is the example on how to have Spring wire domain objects like Account. Which would

Edit
Report