some db code rewriting
[mir.git] / source / mircoders / storage / DatabaseOther.java
index 6fe2936..dd641f9 100755 (executable)
@@ -36,24 +36,11 @@ import mir.entity.Entity;
 import mir.log.LoggerWrapper;
 import mir.misc.StringUtil;
 import mir.storage.Database;
-import mir.storage.StorageObjectFailure;
-
-/**
- *
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) 2003</p>
- * <p>Company: </p>
- * @author not attributable
- * @version 1.0
- */
+import mir.storage.DatabaseFailure;
 
 public class DatabaseOther extends Database {
   private static DatabaseOther instance;
 
-  // the following *has* to be sychronized cause this static method
-  // could get preemted and we could end up with 2 instances of DatabaseFoo..
-  // see the "Singletons with needles and thread" article at JavaWorld -mh
   public synchronized static DatabaseOther getInstance() {
     if (instance == null) {
       instance = new DatabaseOther();
@@ -66,11 +53,10 @@ public class DatabaseOther extends Database {
 
     logger = new LoggerWrapper("Database.OtherMedia");
     mainTable = "other_media";
-    primaryKeySequence = "media_id_seq";
     entityClass = mircoders.entity.EntityOther.class;
   }
 
-  public void update(Entity theEntity) throws StorageObjectFailure {
+  public void update(Entity theEntity) throws DatabaseFailure {
     String date = theEntity.getFieldValue("date");
     if (date == null) {
       date = StringUtil.date2webdbDate(new GregorianCalendar());
@@ -80,7 +66,7 @@ public class DatabaseOther extends Database {
     super.update(theEntity);
   }
 
-  public String insert(Entity theEntity) throws StorageObjectFailure {
+  public String insert(Entity theEntity) throws DatabaseFailure {
     String date = theEntity.getFieldValue("date");
     if (date == null) {
       date = StringUtil.date2webdbDate(new GregorianCalendar());
@@ -89,6 +75,7 @@ public class DatabaseOther extends Database {
     return super.insert(theEntity);
   }
 
-  // initialisierungen aus den statischen Tabellen
-
+  protected String getPrimaryKeySequence() {
+    return "media_id_seq";
+  }
 }