From: rk Date: Mon, 1 Apr 2002 19:43:50 +0000 (+0000) Subject: moved entities of n:m tables away from ostore caching. no primary key was given.... X-Git-Tag: prexmlproducerconfig~167 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=4e6a9876cd4b884ff8c71a39537e90f56acf7bdc;p=mir.git moved entities of n:m tables away from ostore caching. no primary key was given. the right implementation needs to be aware of changes in the dependant tables. StorableObjectEntity cannot be used --- diff --git a/source/mircoders/storage/DatabaseContentToMedia.java b/source/mircoders/storage/DatabaseContentToMedia.java index 1569bb47..90854d72 100755 --- a/source/mircoders/storage/DatabaseContentToMedia.java +++ b/source/mircoders/storage/DatabaseContentToMedia.java @@ -38,6 +38,8 @@ public class DatabaseContentToMedia extends Database implements StorageObject{ super(); this.hasTimestamp = false; this.theTable="content_x_media"; + try { this.theEntityClass = Class.forName("mir.entity.GenericEntity"); } + catch (Exception e) { throw new StorageObjectException(e.toString()); } } /** @@ -81,7 +83,7 @@ public class DatabaseContentToMedia extends Database implements StorageObject{ throw new StorageObjectException("-- hasMedia failed: content is NULL"); } } - + diff --git a/source/mircoders/storage/DatabaseContentToTopics.java b/source/mircoders/storage/DatabaseContentToTopics.java index 1eb41374..8fb8a9ea 100755 --- a/source/mircoders/storage/DatabaseContentToTopics.java +++ b/source/mircoders/storage/DatabaseContentToTopics.java @@ -38,6 +38,9 @@ public class DatabaseContentToTopics extends Database implements StorageObject{ super(); this.hasTimestamp = false; this.theTable="content_x_topic"; + try { this.theEntityClass = Class.forName("mir.entity.GenericEntity"); } + catch (Exception e) { throw new StorageObjectException(e.toString()); } + } /** @@ -60,7 +63,7 @@ public class DatabaseContentToTopics extends Database implements StorageObject{ } return returnList; } - + /** * Returns a ArrayList of Integer-Objects from a content-id. * @returns ArrayList @@ -106,7 +109,7 @@ public class DatabaseContentToTopics extends Database implements StorageObject{ Collection hasTopics = getTopicsOfContent(contentId); Collection toSet = new ArrayList(); Collection toDelete = new ArrayList(); - + if(hasTopics!=null && hasTopics.size()>0){ //now we check if there are new topics and copy them to an array. for(int i = 0; i< topicId.length;i++){ @@ -148,7 +151,7 @@ public class DatabaseContentToTopics extends Database implements StorageObject{ toSet.add(topicId[i]); } } - + //first delete all row with content_id=contentId String sql = "delete from "+ theTable +" where content_id=" + contentId + " and topic_id in (";