Separate business logic from data access in Java so services express business decisions while DAOs own queries, mapping, and persistence mechanics.
The main value of DAO is not “more classes.” It is clearer ownership. Business logic should decide what the system means. Data access code should decide how that meaning reaches storage.
Application and domain services should own decisions such as:
These are business questions, not query questions.
DAOs should own:
That separation keeps services from turning into a mixture of business policy and storage plumbing.
If a service method is filled with SQL strings, session APIs, criteria builders, or row-mapping code, persistence has leaked too far upward.
If a DAO decides whether a discount is valid or whether an order may ship, business logic has leaked too far downward.
A clean DAO boundary improves:
DAO separation becomes counterproductive when:
The goal is not maximum layering. The goal is clean responsibilities.
When reviewing the separation between business logic and DAO code in Java, ask:
A good DAO split makes each layer easier to reason about. A bad one simply moves boilerplate around.