Author: jonesde
Date: Tue Jun 5 14:24:21 2007
New Revision: 544640
URL: http://svn.apache.org/viewvc?view=rev&rev=544640
Log:
Change to adjust for Derby bug with null values in a unique index; this
setting just turns off the unique part of maually declared indices
when set,
as it is now by default for Derby; now the seed data loading and other
things will work though WARNING: unique indices will not work with
Derby; we
don't use these much but we need to watch for it in testing
Modified:
ofbiz/trunk/framework/entity/config/entityengine.xml
ofbiz/trunk/framework/entity/dtd/entity-config.xsd
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java
Modified: ofbiz/trunk/framework/entity/config/entityengine.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/config/entityengine.xml?view=diff&rev=544640&r1=544639&r2=544640
==============================================================================
--- ofbiz/trunk/framework/entity/config/entityengine.xml (original)
+++ ofbiz/trunk/framework/entity/config/entityengine.xml Tue Jun 5
14:24:21 2007
@@ -140,6 +140,7 @@
check-on-start="true"
add-missing-on-start="true"
use-pk-constraint-names="false"
+ use-indices-unique="false"
alias-view-columns="false">
<read-data reader-name="seed"/>
<read-data reader-name="demo"/>
@@ -161,6 +162,7 @@
check-on-start="true"
add-missing-on-start="true"
use-pk-constraint-names="false"
+ use-indices-unique="false"
alias-view-columns="false">
<inline-jdbc
jdbc-driver="org.apache.derby.jdbc.EmbeddedDriver"
Modified: ofbiz/trunk/framework/entity/dtd/entity-config.xsd
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/dtd/entity-config.xsd?view=diff&rev=544640&r1=544639&r2=544640
==============================================================================
--- ofbiz/trunk/framework/entity/dtd/entity-config.xsd (original)
+++ ofbiz/trunk/framework/entity/dtd/entity-config.xsd Tue Jun 5
14:24:21
2007
@@ -304,6 +304,16 @@
</xs:simpleType>
</xs:attribute>
<xs:attribute name="use-indices" default="true">
+ <xs:annotation><xs:documentation>Use manually declared
indices (indexes)?</xs:documentation></xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="use-indices-unique" default="true">
+ <xs:annotation><xs:documentation>For manually declared
indices (if used), use the unique
constraint?</xs:documentation></xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="true"/>
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java?view=diff&rev=544640&r1=544639&r2=544640
==============================================================================
---
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java
(original)
+++
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java
Tue Jun 5 14:24:21 2007
@@ -65,6 +65,7 @@
public String fkStyle = null;
public boolean useFkInitiallyDeferred = true;
public boolean useIndices = true;
+ public boolean useIndicesUnique = true;
public boolean checkIndicesOnStart = false;
public String joinStyle = null;
public boolean aliasViews = true;
@@ -99,6 +100,7 @@
Debug.logWarning("datasource def not found with name " +
this.name + ", using default for fk-style (name_constraint)", module);
Debug.logWarning("datasource def not found with name " +
this.name + ", using default for use-fk-initially-deferred (true)",
module);
Debug.logWarning("datasource def not found with name " +
this.name + ", using default for use-indices (true)", module);
+ Debug.logWarning("datasource def not found with name " +
this.name + ", using default for use-indices-unique (true)", module);
Debug.logWarning("datasource def not found with name " +
this.name + ", using default for check-indices-on-start (false)",
module);
Debug.logWarning("datasource def not found with name " +
this.name + ", using default for join-style (ansi)", module);
Debug.logWarning("datasource def not found with name " +
this.name + ", using default for always-use-constraint-keyword (false)",
module);
@@ -144,6 +146,7 @@
this.useFkInitiallyDeferred = "true".equals(
datasourceElement.getAttribute("use-fk-initially-deferred"));
// anything but false is true
this.useIndices = !"false".equals(
datasourceElement.getAttribute("use-indices"));
+ this.useIndices = !"false".equals(
datasourceElement.getAttribute("use-indices-unique"));
// anything but true is false
this.checkIndicesOnStart = "true".equals(
datasourceElement.getAttribute("check-indices-on-start"));
this.joinStyle = datasourceElement.getAttribute
("join-style");
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java?view=diff&rev=544640&r1=544639&r2=544640
==============================================================================
---
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java
(original)
+++
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java
Tue
Jun 5 14:24:21 2007
@@ -2571,7 +2571,7 @@
}
StringBuffer indexSqlBuf = new StringBuffer("CREATE ");
- if (modelIndex.getUnique()) {
+ if (datasourceInfo.useIndicesUnique && modelIndex.getUnique()) {
indexSqlBuf.append("UNIQUE ");
}
indexSqlBuf.append("INDEX ");