mardi 25 juin 2019

How to refactor service methods that just forward request to DAO?

I have a spring mvc project ,there is quite a lot of code in service layer that just forward request to DAO layer, just as in this example.

https://www.journaldev.com/3531/spring-mvc-hibernate-mysql-integration-crud-example-tutorial

    @Override
    @Transactional
    public void updatePerson(Person p) {
        this.personDAO.updatePerson(p);
    }

    @Override
    @Transactional
    public List<Person> listPersons() {
        return this.personDAO.listPersons();
    }

And according to A Philosophy of Software Design, it is not good.

So what is a better way to refactor service layer and DAO layer?

Aucun commentaire:

Enregistrer un commentaire