Commit 5a461b3766d506fab5a6c343276e1eeae279814f

Authored by Thomas Ziemer
1 parent 377d4aaa

style: em.remove() kommentiert

src/main/java/net/ziemers/swxercise/db/dao/GenericDao.java
... ... @@ -63,8 +63,13 @@ public class GenericDao {
63 63 }
64 64  
65 65 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
  67 + // retrieved and then in an active transaction, it can be deleted using
  68 + // the remove() method.
66 69 final T entity = findById(entityType, primaryKey);
67 70  
  71 + // An "IllegalArgumentException" is thrown by remove(), if the argument
  72 + // is not an instance of an entity class or if it is a detached entity.
68 73 entityManager.remove(entity);
69 74 return entity;
70 75 }
... ...