Commit f8f21bfaf90840fc25958e31f980de076cdd8d69
1 parent
7b1d19e1
feature: GenericDAO erweitert
Showing
2 changed files
with
8 additions
and
0 deletions
src/main/java/net/ziemers/swxercise/db/dao/GenericDao.java
... | ... | @@ -62,6 +62,11 @@ public class GenericDao { |
62 | 62 | return entityManager.merge(entity); |
63 | 63 | } |
64 | 64 | |
65 | + public <T extends BaseEntity> T refresh(final T entity) { | |
66 | + entityManager.refresh(entity); | |
67 | + return entity; | |
68 | + } | |
69 | + | |
65 | 70 | public <T extends BaseEntity> T remove(Class<T> entityType, Long primaryKey) { |
66 | 71 | // In order to delete an object from the database, it has to first be |
67 | 72 | // retrieved and then in an active transaction, it can be deleted using | ... | ... |
src/main/java/net/ziemers/swxercise/ui/UserViewController.java
... | ... | @@ -142,6 +142,9 @@ public class UserViewController { |
142 | 142 | @Produces(MediaType.APPLICATION_JSON) |
143 | 143 | @RolesAllowed(RightState.Constants.ADMIN) |
144 | 144 | public RestResponse updateUser(@PathParam("id") Long id, UserDto dto) { |
145 | + | |
146 | + logger.info("Trying to update user with id #{}.", id); | |
147 | + | |
145 | 148 | if (userService.updateUser(id, dto)) { |
146 | 149 | return new RestResponse(); |
147 | 150 | } | ... | ... |