db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r409935 - in /db/torque: site/trunk/xdocs/changes.xml templates/trunk/src/templates/om/bean/ObjectBeanMethods.vm test/trunk/test-project/src/schema/test-schema.xml
Date Sun, 28 May 2006 07:40:53 GMT
Author: tfischer
Date: Sun May 28 00:40:49 2006
New Revision: 409935

URL: http://svn.apache.org/viewvc?rev=409935&view=rev
Log:
Added patch and test case for a problem in bean generation
when a table has several references to another table.
Thanks to Nicolas Le Griel for the patch and the test case.
Fixes TORQUE-21.

Modified:
    db/torque/site/trunk/xdocs/changes.xml
    db/torque/templates/trunk/src/templates/om/bean/ObjectBeanMethods.vm
    db/torque/test/trunk/test-project/src/schema/test-schema.xml

Modified: db/torque/site/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/changes.xml?rev=409935&r1=409934&r2=409935&view=diff
==============================================================================
--- db/torque/site/trunk/xdocs/changes.xml (original)
+++ db/torque/site/trunk/xdocs/changes.xml Sun May 28 00:40:49 2006
@@ -29,6 +29,10 @@
 
   <release version="3.2.1-dev" date="in SVN">
   
+    <action type="fix" dev="tfischer" issue="TORQUE-21" due-to="Nicolas Le Griel">
+      Fixed bug in bean generation when a table has several references 
+      to another table.
+    </action>
     <action type="fix" dev="tfischer" issue="TORQUE-4" due-to="Joerg Friedrich">
       <ul>
         <li>

Modified: db/torque/templates/trunk/src/templates/om/bean/ObjectBeanMethods.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/bean/ObjectBeanMethods.vm?rev=409935&r1=409934&r2=409935&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/bean/ObjectBeanMethods.vm (original)
+++ db/torque/templates/trunk/src/templates/om/bean/ObjectBeanMethods.vm Sun May 28 00:40:49
2006
@@ -185,10 +185,10 @@
           #end
 
           #if ($relatedByCol == "")
-            #set ( $relCol = "${relatedClassName}s" )
+            #set ( $relCol = "${relatedClassName}" )
             #set ( $beanRelCol = "${relatedBeanClassName}s" )
           #else
-            #set ( $relCol= "${relatedClassName}sRelatedBy$relatedByCol" )
+            #set ( $relCol= "${relatedClassName}RelatedBy$relatedByCol" )
             #set ( $beanRelCol = "${relatedBeanClassName}sRelatedBy$relatedByCol" )
           #end
 
@@ -200,7 +200,7 @@
                 {
                     $relatedBeanClassName relatedBean = #if(!$enableJava5Features)($relatedBeanClassName)#end
relatedBeansIt.next();
                     ${relatedClassName} related = ${relatedClassName}.create${relatedClassName}(relatedBean,
createdObjects);
-                    result.add${relatedClassName}FromBean(related);
+                    result.add${relCol}FromBean(related);
                 }
             }
         }

Modified: db/torque/test/trunk/test-project/src/schema/test-schema.xml
URL: http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/src/schema/test-schema.xml?rev=409935&r1=409934&r2=409935&view=diff
==============================================================================
--- db/torque/test/trunk/test-project/src/schema/test-schema.xml (original)
+++ db/torque/test/trunk/test-project/src/schema/test-schema.xml Sun May 28 00:40:49 2006
@@ -366,4 +366,27 @@
         foreign="CIRCULAR_REFERENCE_A_ID"/>
     </foreign-key>
   </table>
+  
+  <!-- Torque OM generated code does not compile if bean generation is activated and a
table references an other table several times -->
+  <table name="referenced" javaName="Referenced" description="Table referenced by several
columns of an other table">
+    <column name="referenced_pk" javaName="referencedPK" required="true" primaryKey="true"
type="VARCHAR" size="12"/>
+    <column name="other_information" javaName="otherInformation" type="VARCHAR" size="255"/>
+  </table>
+
+  <table name="multi_ref_same_table"  description="Table to test multi references to a
same table">
+    <column name="multi_ref_same_table_pk" required="true" primaryKey="true" type="VARCHAR"
size="12"/>
+    <column name="an_information" required="true" type="VARCHAR" size="128"/>
+    <column name="reference_1" type="VARCHAR" size="12"/>
+    <column name="reference_2" type="VARCHAR" size="12"/>
+    <column name="reference_3" type="VARCHAR" size="12"/>
+    <foreign-key foreignTable="referenced">
+      <reference local="reference_1" foreign="referenced_pk"/>
+    </foreign-key>
+    <foreign-key foreignTable="referenced">
+      <reference local="reference_2" foreign="referenced_pk"/>
+    </foreign-key>
+    <foreign-key foreignTable="referenced">
+      <reference local="reference_3" foreign="referenced_pk"/>
+    </foreign-key>
+  </table>
 </database>



---------------------------------------------------------------------
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