*** empty log message ***
[mir.git] / source / mircoders / storage / DatabaseUploadedMedia.java
index 49d7de6..428edc4 100755 (executable)
@@ -42,7 +42,7 @@ public class DatabaseUploadedMedia extends Database implements StorageObject {
     super();
     this.theTable="uploaded_media";
     this.theCoreTable="media";
-    relationMediaType = new EntityRelation("id", "to_media_type", DatabaseMediaType.getInstance(), EntityRelation.TO_ONE);
+    relationMediaType = new EntityRelation("to_media_type", "id", DatabaseMediaType.getInstance(), EntityRelation.TO_ONE);
     try { this.theEntityClass = Class.forName("mircoders.entity.EntityUploadedMedia"); }
     catch (Exception e) { throw new StorageObjectException(e.toString()); }
   }
@@ -54,15 +54,16 @@ public class DatabaseUploadedMedia extends Database implements StorageObject {
    * returns the comments that belong to the article (via entityrelation)
    * where db-flag is_published is true
    */
-  public SimpleList getMediaType(EntityUploadedMedia ent) {
-    SimpleList comments=null;
+  public Entity getMediaType(Entity ent) throws StorageObjectException {
+    Entity type=null;
     try {
-      comments = relationMediaType.getManyAsSimpleList(ent,"webdb_create","is_published='1'");
+      type = relationMediaType.getOne(ent);
     }
     catch (StorageObjectException e) {
       theLog.printError("DatabaseUploadedMedia :: failed to get media_type");
+      throw new StorageObjectException("DatabaseUploadedMedia :: failed to get media_type"+ e.toString());
     }
-    return comments;
+    return type;
   }
 
 }