changeset 190:bf7488ec0e8d

Added method to delete objects from database.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 01 Jul 2013 14:16:20 +0200
parents e9e83fa2a4ae
children 253160854d79
files src/main/java/de/intevation/lada/manage/DataManager.java src/main/java/de/intevation/lada/manage/Manager.java
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/manage/DataManager.java	Mon Jul 01 14:15:00 2013 +0200
+++ b/src/main/java/de/intevation/lada/manage/DataManager.java	Mon Jul 01 14:16:20 2013 +0200
@@ -41,7 +41,9 @@
 
     @Override
     @TransactionAttribute(TransactionAttributeType.REQUIRED)
-    public <T> void delete(String id, Class<T> clazz) throws Exception {
-        
+    public <T> void delete(Object object)
+    throws IllegalArgumentException,
+        TransactionRequiredException {
+        em.remove(em.contains(object) ? object : em.merge(object));
     }
 }
--- a/src/main/java/de/intevation/lada/manage/Manager.java	Mon Jul 01 14:15:00 2013 +0200
+++ b/src/main/java/de/intevation/lada/manage/Manager.java	Mon Jul 01 14:16:20 2013 +0200
@@ -25,5 +25,7 @@
         TransactionRequiredException;
 
     @TransactionAttribute(TransactionAttributeType.REQUIRED)
-    public <T> void delete(String id, Class<T> clazz) throws Exception;
+    public <T> void delete(Object object)
+    throws IllegalArgumentException,
+        TransactionRequiredException;
 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)