dlr 01/11/28 01:51:57
Modified: conf/torque/templates/sql/base/oracle unique.vm
src/java/org/apache/turbine/torque/engine/database/model
Table.java Unique.java
Log:
The name of the constraint is taking account except for the unique
constraint. To be able to generate a naming index in the schema generation for
Oracle schema definition like this:
CREATE TABLE TEST
(
ID INT NOT NULL,
NAME VARCHAR2 (255)
CONSTRAINT MY_UNIQUE_1 UNIQUE (NAME)
)
The attribute name in the XML definition file must be take into account,
two Java classes have to be modified Unique.java and Table.java.
And the Unique.vm file for Oracle.
Revision Changes Path
1.2 +2 -2
jakarta-turbine-2/conf/torque/templates/sql/base/oracle/unique.vm
Index: unique.vm
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/conf/torque/templates/sql/base/oracle/unique.vm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -u -r1.1 -r1.2
--- unique.vm 2001/08/16 05:07:01 1.1
+++ unique.vm 2001/11/28 09:51:57 1.2
@@ -1,3 +1,3 @@
#foreach ($unique in $table.Unices)
- UNIQUE ($unique.ColumnList),
-#end
\ No newline at end of file
+ CONSTRAINT $unique.IndexName UNIQUE ($unique.ColumnList),
+#end
1.3 +2 -1
jakarta-turbine-2/src/java/org/apache/turbine/torque/engine/database/model/Table.java
Index: Table.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/torque/engine/database/model/Table.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- Table.java 2001/08/20 02:49:31 1.2
+++ Table.java 2001/11/28 09:51:57 1.3
@@ -71,7 +71,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Martin Poeschl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">John McNally</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
- * @version $Id: Table.java,v 1.2 2001/08/20 02:49:31 brekke Exp $
+ * @version $Id: Table.java,v 1.3 2001/11/28 09:51:57 dlr Exp $
*/
public class Table implements IDMethod
{
@@ -410,6 +410,7 @@
public Unique addUnique(Attributes attrib)
{
Unique unique = new Unique();
+ unique.loadFromXML (attrib);
addUnique (unique);
return unique;
}
1.2 +18 -1
jakarta-turbine-2/src/java/org/apache/turbine/torque/engine/database/model/Unique.java
Index: Unique.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/torque/engine/database/model/Unique.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -u -r1.1 -r1.2
--- Unique.java 2001/08/16 05:09:33 1.1
+++ Unique.java 2001/11/28 09:51:57 1.2
@@ -62,7 +62,7 @@
* A Class for information about unique indices of a table
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: Unique.java,v 1.1 2001/08/16 05:09:33 jvanzyl Exp $
+ * @version $Id: Unique.java,v 1.2 2001/11/28 09:51:57 dlr Exp $
*/
public class Unique
{
@@ -94,6 +94,15 @@
}
/**
+ * Get the name of the unique index
+ */
+ public String getIndexName()
+ {
+ return indexName;
+ }
+
+
+ /**
* Returns the Name of the table the foreign key is in
*/
public String getTableName()
@@ -153,5 +162,13 @@
.append("\"/>\n");
result.append(" </unique>\n");
return result.toString();
+ }
+
+ /**
+ * Imports a column from an XML specification
+ */
+ public void loadFromXML (Attributes attrib)
+ {
+ indexName = attrib.getValue("name");
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>