I'm in the beginning of a project which I want to have the best testability and maintainability possible. To achieve this, I'm reading a lot about concepts in the DDD area, mainly.
To get you contextualized, suppose the following entities:
It's basically a container for Accounts (see below) and configurations;
It's a way for a User to login. Each User may have various accounts, one for each OAuth provider (Facebook, Google, etc);
It's a token that points to a User + expiration date. Each login generates a new Session.
I need to find a User by Account (when I'm logging in) or Session (when I'm already logged in).
However, I'm afraid that I'll be bloating my DAOs with
findByX methods - these seem to be the most performant and simple to understand, but they kinda couple the DB structure to some business rule - or am I wrong?
This post says that I should be using a
Specification interface, which its implementations should return the right query criteria.
Is there any problem I may face upfront - like bloating my DAOs with
find methods, or am I just over concerned with this architecture?