Commit f8f21bfaf90840fc25958e31f980de076cdd8d69

Authored by Thomas Ziemer
1 parent 7b1d19e1

feature: GenericDAO erweitert

src/main/java/net/ziemers/swxercise/db/dao/GenericDao.java
@@ -62,6 +62,11 @@ public class GenericDao { @@ -62,6 +62,11 @@ public class GenericDao {
62 return entityManager.merge(entity); 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 public <T extends BaseEntity> T remove(Class<T> entityType, Long primaryKey) { 70 public <T extends BaseEntity> T remove(Class<T> entityType, Long primaryKey) {
66 // In order to delete an object from the database, it has to first be 71 // In order to delete an object from the database, it has to first be
67 // retrieved and then in an active transaction, it can be deleted using 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,6 +142,9 @@ public class UserViewController {
142 @Produces(MediaType.APPLICATION_JSON) 142 @Produces(MediaType.APPLICATION_JSON)
143 @RolesAllowed(RightState.Constants.ADMIN) 143 @RolesAllowed(RightState.Constants.ADMIN)
144 public RestResponse updateUser(@PathParam("id") Long id, UserDto dto) { 144 public RestResponse updateUser(@PathParam("id") Long id, UserDto dto) {
  145 +
  146 + logger.info("Trying to update user with id #{}.", id);
  147 +
145 if (userService.updateUser(id, dto)) { 148 if (userService.updateUser(id, dto)) {
146 return new RestResponse(); 149 return new RestResponse();
147 } 150 }