empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1185519 - /incubator/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Table.vm
Date Tue, 18 Oct 2011 07:55:17 GMT
Author: doebele
Date: Tue Oct 18 07:55:17 2011
New Revision: 1185519

URL: http://svn.apache.org/viewvc?rev=1185519&view=rev
Log:
EMPIREDB-117
minor improvement in primary-key definition syntax

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=1185519&r1=1185518&r2=1185519&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 Tue
Oct 18 07:55:17 2011
@@ -34,7 +34,6 @@ public class $parser.getTableClassName($
 #end
 
 	private static final long serialVersionUID = 1L;
-	private List<DBTableColumn> keyColumns = new ArrayList<DBTableColumn>();
 	
 	// define columns
 #foreach ($col in $table.columns)
@@ -50,10 +49,18 @@ public class $parser.getTableClassName($
 #end
 
 		// configure key columns (primary key)
+#if($table.keyColumns.size()==1)
+		setPrimaryKey(${parser.getColumnName($table.keyColumns[0])});
+#else
+		DBTableColumn[] keyColumns = new DBTableColumn[] {
 #foreach ($col in $table.keyColumns)
-    	keyColumns.add(${parser.getColumnName($col)});
+#if($foreach.isLast()==false)
+    		${parser.getColumnName($col)},
+#else
+    		${parser.getColumnName($col)} };
+		setPrimaryKey(keyColumns);
+#end    	
 #end
-		setPrimaryKey(keyColumns.toArray(new DBTableColumn[keyColumns.size()]));
 		
 		// Optimistic locking column
 #if($parser.hasLockingColumn($table) == true)
@@ -61,6 +68,7 @@ public class $parser.getTableClassName($
 #else
 		/*no locking column specified*/
 #end
+#end
 
 		// Set cascade delete
 		setCascadeDelete(true);		



Mime
View raw message