summaryrefslogtreecommitdiffstats
path: root/java/MyMyBatis/src/AbstractDAOOperations.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/MyMyBatis/src/AbstractDAOOperations.java')
-rw-r--r--java/MyMyBatis/src/AbstractDAOOperations.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/java/MyMyBatis/src/AbstractDAOOperations.java b/java/MyMyBatis/src/AbstractDAOOperations.java
index 5307641..a96e336 100644
--- a/java/MyMyBatis/src/AbstractDAOOperations.java
+++ b/java/MyMyBatis/src/AbstractDAOOperations.java
@@ -2,7 +2,9 @@ package ch.asynk;
import java.util.List;
-public abstract class AbstractDAOOperations<TObject, TIdentity, TMapper extends AbstractMapper<TObject, TIdentity>> extends AbstractDAO<TObject, TMapper>
+public abstract class AbstractDAOOperations<TIdentity,
+ TObject extends AbstractModel<TIdentity>,
+ TMapper extends AbstractMapper<TObject, TIdentity>> extends AbstractDAO<TObject, TMapper>
{
public int insert(final TObject obj)
@@ -15,6 +17,11 @@ public abstract class AbstractDAOOperations<TObject, TIdentity, TMapper extends
return execInt(m -> m.update(obj), true);
}
+ public int save(final TObject obj)
+ {
+ return (obj.isUnsaved() ? insert(obj) : update(obj));
+ }
+
public int delete(final TObject obj)
{
return execInt(m -> m.delete(obj), true);