Author: tfischer
Date: Sat Sep 10 11:57:59 2011
New Revision: 1167499

URL: http://svn.apache.org/viewvc?rev=1167499&view=rev
Log:
- explicit check if db adapter is set when building the database map
- changed comment about implementation from java comment to velocity comment 

Modified:
    
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/doBuild.vm

Modified: 
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/doBuild.vm
URL: 
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/doBuild.vm?rev=1167499&r1=1167498&r2=1167499&view=diff
==============================================================================
--- 
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/doBuild.vm
 (original)
+++ 
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/mapBuilder/doBuild.vm
 Sat Sep 10 11:57:59 2011
@@ -67,8 +67,8 @@
 #end
 #set ( $idMethodParameterElements = 
$tableElement.getChildren("id-method-parameter"))
 #if (!$idMethodParameterElements.isEmpty())
-        // this might need upgrading based on what all the databases
-        // need, but for now assume one parameter.
+## this might need upgrading based on what all the databases
+## need, but for now assume one parameter.
   #set ( $idMethodParameterElement = $idMethodParameterElements.get(0) )
   #set ( $value = $idMethodParameterElement.getAttribute("value") )
         tMap.setPrimaryKeyMethodInfo("$value");
@@ -76,6 +76,10 @@
         tMap.setPrimaryKeyMethodInfo(tMap.getName());
 #elseif ($idMethod == "native")
         org.apache.torque.adapter.DB dbAdapter = Torque.getDB("$databaseName");
+        if (dbAdapter == null)
+        {
+           throw new TorqueException("missing adapter configuration for 
database ${databaseName}, check the Torque configuration");
+        }
         if 
(dbAdapter.getIDMethodType().equals(org.apache.torque.adapter.DB.SEQUENCE))
         {
             tMap.setPrimaryKeyMethodInfo("$sequence");



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to