Browse Source

jfinal 3.7

James 6 years ago
parent
commit
63823acd8f

+ 6 - 1
src/main/java/com/jfinal/plugin/activerecord/generator/MetaBuilder.java

@@ -211,10 +211,15 @@ public class MetaBuilder {
 		String primaryKey = "";
 		int index = 0;
 		while (rs.next()) {
+			String cn = rs.getString("COLUMN_NAME");
+			if (primaryKey.equals(cn)) {
+				continue ;
+			}
+			
 			if (index++ > 0) {
 				primaryKey += ",";
 			}
-			primaryKey += rs.getString("COLUMN_NAME");
+			primaryKey += cn;
 		}
 		
 		// 无主键的 table 将在后续的 removeNoPrimaryKeyTable() 中被移除,不再抛出异常