Question

Currently i'm part of a project (spring with JPA) that has the following layering:

  1. service layer (checks for authorization and delegates actions to the manager layer)
  2. manager layer - does lots of buisiness logic and then calls: entityManager.save(object)

As you can see there is no DAO layer in this project and as a DAO layer fanatic i'm starting to fall in love with this setup instead.

what are the pros \ cons of this setup?

Should we bother with dao?

Was it helpful?

Solution

Separation of concerns is the word that you should think before falling in love with this approach. In general practice business logic and dao logic should be kept separate as in case if in future you decide to change your database you need not go through every class searching for change the way to access new database but in DAO layer approach you need to change only your DAO layer as business layer remains intact.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top