这是我 的解决办法 可能 不是最好的 有最好的欢迎 大佬分享 我是把循环主键注掉了
/**
* 重写jfinal生成主键规则
* @author String
*
*/
public class MyMetaBuilder extends MetaBuilder{
public MyMetaBuilder(DataSource dataSource) {
super(dataSource);
// TODO Auto-generated constructor stub
}
@Override
public void buildPrimaryKey(TableMeta tableMeta) throws SQLException{
ResultSet rs = dbMeta.getPrimaryKeys(conn.getCatalog(), null, tableMeta.name);
String primaryKey = "";
int index = 0;
while (rs.next()) {
/*if (index++ > 0) {
primaryKey += ",";
}*/
primaryKey = rs.getString("COLUMN_NAME");
}
if (StrKit.isBlank(primaryKey)) {
throw new RuntimeException("primaryKey of table \"" + tableMeta.name + "\" required by active record pattern");
}
tableMeta.primaryKey = primaryKey;
rs.close();
}
}