@@ -0,0 +1,1931 @@
+/*%0D%0A *  Copyright 2012 The MyBatis Team%0D%0A *%0D%0A *  Licensed under the Apache License, Version 2.0 (the %22License%22);%0D%0A *  you may not use this file except in compliance with the License.%0D%0A *  You may obtain a copy of the License at%0D%0A *%0D%0A *      http://www.apache.org/licenses/LICENSE-2.0%0D%0A *%0D%0A *  Unless required by applicable law or agreed to in writing, software%0D%0A *  distributed under the License is distributed on an %22AS IS%22 BASIS,%0D%0A *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0D%0A *  See the License for the specific language governing permissions and%0D%0A *  limitations under the License.%0D%0A */%0D%0Apackage org.mybatis.generator.plugins;%0D%0A%0D%0Aimport java.util.List;%0D%0Aimport java.util.StringTokenizer;%0D%0A%0D%0Aimport org.mybatis.generator.api.IntrospectedTable;%0D%0Aimport org.mybatis.generator.api.PluginAdapter;%0D%0A%0D%0A/**%0D%0A * This plugin can be used to specify columns that act as a primary key, even%0D%0A * if they are not strictly defined as primary keys in the database.%0D%0A * %0D%0A * To use the plugin, add a property to the table configuration%0D%0A * specifying a comma delimited list of column names to use as a primary%0D%0A * key:%0D%0A * %0D%0A * %3Ctable...%3E%0D%0A *   %3Cproperty name=%22virtualKeyColumns%22 value=%22ID1,ID2%22/%3E%0D%0A * %3C/table%3E%0D%0A * %0D%0A * @author Jeff Butler%0D%0A *%0D%0A */%0D%0Apublic class VirtualPrimaryKeyPlugin extends PluginAdapter %7B%0D%0A%0D%0A    public boolean validate(List%3CString%3E warnings) %7B%0D%0A        return true;%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    public void initialized(IntrospectedTable introspectedTable) %7B%0D%0A        String virtualKey =%0D%0A        introspectedTable.getTableConfiguration().getProperty(%22virtualKeyColumns%22);%0D%0A        %0D%0A        if (virtualKey != null) %7B%0D%0A            StringTokenizer st = new StringTokenizer(virtualKey, %22, %22, false);%0D%0A            while (st.hasMoreTokens()) %7B%0D%0A                String column = st.nextToken();%0D%0A                introspectedTable.addPrimaryKeyColumn(column);%0D%0A            %7D%0D%0A        %7D%0D%0A    %7D%0D%0A%7D%0D%0A

Add virtual primary key plugin