Scarab commit: svn commit: r10723 - branches/release/0.22/src/java/org/tigris/scarab/om/AbstractScarabModule.java

Johannes Höchstädter <[email protected]>
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: jhoech
Date: 2009-05-18 00:42:28-0700
New Revision: 10723

Modified:
   branches/release/0.22/src/java/org/tigris/scarab/om/AbstractScarabModule.java

Log:
FIX - method getAllAttributes in AbstractScarabModule should not return all mappings from RModuleAttribute. Otherwise List of attributes contains many duplicates, and I think nobody will ask for the count of mappings int his case...

Modified: branches/release/0.22/src/java/org/tigris/scarab/om/AbstractScarabModule.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/0.22/src/java/org/tigris/scarab/om/AbstractScarabModule.java?view=diff&pathrev=10723&r1=10722&r2=10723
==============================================================================
--- branches/release/0.22/src/java/org/tigris/scarab/om/AbstractScarabModule.java	(original)
+++ branches/release/0.22/src/java/org/tigris/scarab/om/AbstractScarabModule.java	2009-05-18 00:42:28-0700
@@ -526,7 +526,8 @@
     }
 
     /**
-     * gets a list of all of the Attributes in a Module based on the Criteria.
+     * gets a list of all of the Attributes in a Module based on the Criteria
+     * and based on r_module_attribute mappings.
      */
     public List getAttributes(final Criteria criteria)
         throws TorqueException
@@ -1118,7 +1119,13 @@
     public List getAllAttributes()
         throws TorqueException
     {
-        return getAttributes(new Criteria());
+    	Criteria crit = new Criteria();
+    	crit.addJoin(RModuleAttributePeer.ATTRIBUTE_ID, AttributePeer.ATTRIBUTE_ID);
+    	crit.add(RModuleAttributePeer.MODULE_ID, getModuleId());  	 
+    	crit.setDistinct();
+    	List result = AttributePeer.doSelect(crit);
+    	
+        return result;
     }
     
     /**

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=2297842
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.