Author: jonesde
Date: Fri Feb 26 18:41:11 2010
New Revision: 916781
URL:
http://svn.apache.org/viewvc?rev=916781&view=revLog:
Changed to not try to do a distinct count by a specific column, which was introduced in rev 897605, as it seems to cause a number of problems and is a feature that probably isn't used much since it was introduced about a month ago; reintroducing this feature will require additional effort to resolve these
Modified:
ofbiz/trunk/framework/entity/config/entityengine.xml
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
Modified: ofbiz/trunk/framework/entity/config/entityengine.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/config/entityengine.xml?rev=916781&r1=916780&r2=916781&view=diff==============================================================================
--- ofbiz/trunk/framework/entity/config/entityengine.xml (original)
+++ ofbiz/trunk/framework/entity/config/entityengine.xml Fri Feb 26 18:41:11 2010
@@ -50,7 +50,7 @@
<connection-factory class="org.ofbiz.entity.connection.DBCPConnectionFactory"/>
<delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">
- <group-map group-name="org.ofbiz" datasource-name="localderby"/>
+ <group-map group-name="org.ofbiz" datasource-name="localmysql"/>
<group-map group-name="org.ofbiz.olap" datasource-name="localderbyolap"/>
</delegator>
<delegator name="default-no-eca" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" entity-eca-enabled="false" distributed-cache-clear-enabled="false">
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=916781&r1=916780&r2=916781&view=diff==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Fri Feb 26 18:41:11 2010
@@ -1011,6 +1011,10 @@
}
if (findOptions.getDistinct()) {
+ sqlBuffer.append("DISTINCT COUNT(*) ");
+ /* DEJ20100226: this seems to cause too many problems so the line above is used instead;
+ * may need varying SQL for different databases, and also in view-entities in some cases it seems to
+ * cause the "COUNT(DISTINCT " to appear twice, causing an attempt to try to count a count (function="count-distinct", distinct=true in find options)
if (selectFields != null && selectFields.size() > 0) {
sqlBuffer.append("COUNT(DISTINCT ");
// this only seems to support a single column, which is not desirable but seems a lot better than no columns or in certain cases all columns
@@ -1020,6 +1024,7 @@
} else {
sqlBuffer.append("COUNT(DISTINCT *) ");
}
+ */
} else {
// NOTE DEJ20080701 Changed from COUNT(*) to COUNT(1) to improve performance, and should get the same results at least when there is no DISTINCT
sqlBuffer.append("COUNT(1) ");