You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by fr...@apache.org on 2012/01/23 18:12:39 UTC

svn commit: r1234905 - /incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Table.vm

Author: francisdb
Date: Mon Jan 23 17:12:39 2012
New Revision: 1234905

URL: http://svn.apache.org/viewvc?rev=1234905&view=rev
Log:
EMPIREDB-128 Velocity Template Table.vm does not handle tables without primary keys
patch by Christian Albrecht

Modified:
    incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Table.vm

Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Table.vm
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Table.vm?rev=1234905&r1=1234904&r2=1234905&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Table.vm (original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Table.vm Mon Jan 23 17:12:39 2012
@@ -46,19 +46,21 @@ public class $parser.getTableClassName($
 #end
 
 		// configure key columns (primary key)
+#if($table.keyColumns.size()>0)
 #if($table.keyColumns.size()==1)
 		setPrimaryKey(${parser.getColumnName($table.keyColumns[0])});
 #else
 		DBTableColumn[] keyColumns = new DBTableColumn[] {
 #foreach ($col in $table.keyColumns)
 #if($foreach.isLast()==false)
-    		${parser.getColumnName($col)},
+			${parser.getColumnName($col)},
 #else
-    		${parser.getColumnName($col)} };
+			${parser.getColumnName($col)} };
 		setPrimaryKey(keyColumns);
-#end    	
 #end
-		
+#end
+#end
+
 		// Optimistic locking column
 #if($parser.hasLockingColumn($table) == true)
 		setTimestampColumn(${parser.getColumnName($table.getTimestampColumn())});