Add a DAO tier that will contain the logical part of the methods save
, delete
, update
, etc.
Here is how I usually do:
basepackage.domain
: contains all your entities (data only, no logical part - in your caseProduct
andCustomer
)basepackage.dao
: contains all your DAOs, only used to access the data, basically one per entity, each one containing methods such asfindAll() : List<E>
,findOne(K id) : E
,save(E e) : void
, etc.basepackage.service
: contains all your services, the logical part of the app. The services are the only ones that are calling the DAOs.basepackage.presentation
(orbasepackage.web
for a webapp): contains the HMI/web services/... implementation.