db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1057215 - /db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
Date Mon, 10 Jan 2011 14:41:11 GMT
Author: tfischer
Date: Mon Jan 10 14:41:10 2011
New Revision: 1057215

URL: http://svn.apache.org/viewvc?rev=1057215&view=rev
Log:
honor the id-method-parameter element for calculating sequence names

Modified:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java?rev=1057215&r1=1057214&r2=1057215&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
Mon Jan 10 14:41:10 2011
@@ -111,10 +111,22 @@ public class SQLTransformer implements S
         if (tableElement.getAttribute(SqlAttributeName.SEQUENCE_NAME)
                 == null)
         {
-            // TODO: Sequence name length from database descriptor
-            String sequenceName =
-                (tableName.length() > 27 ? tableName.substring(0, 26) : tableName)
-                  + "_SEQ";
+            String sequenceName = null;
+            SourceElement idMethodParameterElement = tableElement.getChild(
+                    TorqueSchemaElementName.ID_METHOD_PARAMETER);
+            if (idMethodParameterElement != null)
+            {
+                sequenceName = (String) idMethodParameterElement.getAttribute(
+                        TorqueSchemaAttributeName.VALUE);
+            }
+            if (StringUtils.isBlank(sequenceName))
+            {
+                // TODO: Sequence name length from database descriptor
+                sequenceName = (tableName.length() > 27 
+                          ? tableName.substring(0, 26)
+                          : tableName)
+                      + "_SEQ";
+            }
             tableElement.setAttribute(
                     SqlAttributeName.SEQUENCE_NAME,
                     sequenceName);



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message