Here you can find the source of createPrimaryKeysQuery(String tableName, List
public static String createPrimaryKeysQuery(String tableName, List<String> primaryKeys)
//package com.java2s; //License from project: LGPL import java.util.List; public class Main { public static String createPrimaryKeysQuery(String tableName, List<String> primaryKeys) { StringBuilder query = new StringBuilder("ALTER TABLE "); query.append(tableName);//from w w w.ja v a 2 s . c o m query.append(" ADD PRIMARY KEY ("); for (String key : primaryKeys) { query.append(key); query.append(","); } query.setLength(query.length() - 1); query.append(")"); return query.toString(); } }