abstraction-layer

Repository vs. DAO (again)

此生再无相见时 提交于 2019-12-07 08:53:57
问题 In general this back-story does not matter but just to explain the code below: The server handles users and user groups. User groups are able to "discover" places - at this point in time these places are coming exclusively from the Google Places API. Current Implementation Currently, I have a lot of JpaRepository objects, which I call Repository , in my Service Layer. I am stressing " Repository " because in my proposed solution below, they'd be downgraded to DAOs. However, what I do not like

Repository vs. DAO (again)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 16:33:22
In general this back-story does not matter but just to explain the code below: The server handles users and user groups. User groups are able to "discover" places - at this point in time these places are coming exclusively from the Google Places API. Current Implementation Currently, I have a lot of JpaRepository objects, which I call Repository , in my Service Layer. I am stressing " Repository " because in my proposed solution below, they'd be downgraded to DAOs. However, what I do not like in my current code, and also the reason for my question here, is the amount of repositories one can

Should I convert an entity to a DTO inside a Repository object and return it to the service layer?

二次信任 提交于 2019-11-28 03:40:42
问题 I am trying to get an answer to the two quite similar questions here: Should I convert an entity to a DTO inside a Repository object and return it to the Service Layer? or Is it okay to return DTO objects from the Repository Layer? Right now I am stuck in my Servlet (Servie Layer) that e.g. tries to retrieve all Restaurant objects from a RestaurantOwnerRepository : // RestaurantOwnerService (Servlet) @Override @Transactional public List<RestaurantDTO> getAvailableRestaurants() { List