I am trying to figure out the exact role of services and how they are used in relationship to dao objects.
I have several dao objects (User, Group, Role), each dao object is accessed via a service.
I have one java application (as opposed to a webapp) that will access many of the services (e.g. GroupService, UserService, RoleService) in order to save users, groups, roles, etc as it processes data.
Group group = new Group();
User user = new User();
My question is that I am wondering if I should create a service that encapsulates the User, Group, Role service so that the Hibernate session is shared across them all the domain objects, or is my understanding wrong?
My basic understanding is that I should create a service that would wrapper any of the dao objects that I would want to participate within a single transaction. If I have a a use case scenario that only involves roles, I would have to have a RoleService just to handle roles, however, if I want to handle a use case that simitaneously changes roles and users, I would create a UserRoleService.
Is my understanding correct, or do I need to be spanked?