db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1003746 - /db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/adderReferencingObject.vm
Date Sat, 02 Oct 2010 05:55:29 GMT
Author: tfischer
Date: Sat Oct  2 05:55:29 2010
New Revision: 1003746

URL: http://svn.apache.org/viewvc?rev=1003746&view=rev
Log:
- TORQUE-149: remove throws clause for adder if silentDbFetch is false
- change statement clauses to run in NullPointreException if toAdd is null before adding null
to the collection
- documented Exceptions

Modified:
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/adderReferencingObject.vm

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/adderReferencingObject.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/adderReferencingObject.vm?rev=1003746&r1=1003745&r2=1003746&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/adderReferencingObject.vm
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/adderReferencingObject.vm
Sat Oct  2 05:55:29 2010
@@ -26,6 +26,7 @@
 ## "foreign-key" element from the torque schema, which was generated 
 ## by the OMTransformer.  
 ##
+#set ( $silentDbFetch = $torqueGen.booleanOption("torque.om.silentDbFetch") )
 #set ( $foreignKeyElement = $torqueGen.getParent() )
 #set ( $localTableElement = $foreignKeyElement.getChild("table") )
 #set ( $localClassName = $localTableElement.getAttribute("dbObjectClassName") )
@@ -33,15 +34,27 @@
 #set ( $foreignKeyLocalColumnSetter = $foreignKeyLocalFieldElement.getAttribute("setter"))
     /**
      * Method called to associate a $fieldContainedType object to this object
-     * through the $field foreign key attribute
+     * through the $field foreign key attribute.
+#if ($silentDbFetch)
+     * If the associated objects were not retrieved before
+     * and this object is not new, the associated objects are retrieved
+     * from the database before adding the <code>toAdd</code> object.
+#end
      *
-     * @param l $fieldContainedType
-     * @throws TorqueException
+     * @param toAdd the object to add to the associated objects, not null.
+#if ($silentDbFetch)
+     *
+     * @throws TorqueException if retrieval of the associated objects fails.
+#end
+     * @throws NullPointerException if toAdd is null.
      */
-    public void ${adder}($fieldContainedType l) throws TorqueException
+    public void ${adder}($fieldContainedType toAdd)
+#if ($silentDbFetch)
+        throws TorqueException
+#end
     {
-        ${getter}().add(l);
-        l.${foreignKeyLocalColumnSetter}(($localClassName) this);
+        toAdd.${foreignKeyLocalColumnSetter}(($localClassName) this);
+        ${getter}().add(toAdd);
     }
 
     /**



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