You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by jg...@apache.org on 2008/10/10 22:08:12 UTC

svn commit: r703569 [3/6] - in /ibatis/trunk/java/tools/ibator/core: build/ devlib/ doc/ src/org/apache/ibatis/ibator/api/ src/org/apache/ibatis/ibator/config/ src/org/apache/ibatis/ibator/config/xml/ src/org/apache/ibatis/ibator/generator/ src/org/apa...

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/DeleteByExampleMethodGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/DeleteByExampleMethodGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/DeleteByExampleMethodGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/DeleteByExampleMethodGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,93 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class DeleteByExampleMethodGenerator extends DAOElementGeneratorBaseImpl {
+
+    public DeleteByExampleMethodGenerator() {
+        super();
+    }
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        StringBuilder sb = new StringBuilder();
+        sb.append("int rows = "); //$NON-NLS-1$
+        sb.append(daoTemplate.getDeleteMethod(table.getSqlMapNamespace(),
+                XmlConstants.DELETE_BY_EXAMPLE_STATEMENT_ID, "example")); //$NON-NLS-1$
+        method.addBodyLine(sb.toString());
+        method.addBodyLine("return rows;"); //$NON-NLS-1$
+
+        if (ibatorContext.getPlugins().daoDeleteByExampleMethodGenerated(method, topLevelClass, introspectedTable)) {
+            topLevelClass.addImportedTypes(importedTypes);
+            topLevelClass.addMethod(method);
+        }
+    }
+
+    public void addInterfaceElements(Interface interfaze) {
+        if (getExampleMethodVisibility() == JavaVisibility.PUBLIC) {
+            Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+            Method method = getMethodShell(importedTypes);
+            
+            if (ibatorContext.getPlugins().daoDeleteByExampleMethodGenerated(method, interfaze, introspectedTable)) {
+                interfaze.addImportedTypes(importedTypes);
+                interfaze.addMethod(method);
+            }
+        }
+    }
+
+    private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType type = introspectedTable.getExampleType();
+        importedTypes.add(type);
+
+        Method method = new Method();
+        method.setVisibility(getExampleMethodVisibility());
+        method.setReturnType(FullyQualifiedJavaType.getIntInstance());
+        method.setName(getDAOMethodNameCalculator()
+                .getDeleteByExampleMethodName(introspectedTable));
+        method.addParameter(new Parameter(type, "example")); //$NON-NLS-1$
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            importedTypes.add(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method,
+                table);
+
+        return method;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/DeleteByPrimaryKeyMethodGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/DeleteByPrimaryKeyMethodGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/DeleteByPrimaryKeyMethodGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/DeleteByPrimaryKeyMethodGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,131 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.IntrospectedColumn;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+import org.apache.ibatis.ibator.internal.util.JavaBeansUtil;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class DeleteByPrimaryKeyMethodGenerator extends DAOElementGeneratorBaseImpl {
+
+    public DeleteByPrimaryKeyMethodGenerator() {
+        super();
+    }
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+
+        StringBuilder sb = new StringBuilder();
+
+        if (!introspectedTable.getRules().generatePrimaryKeyClass()) {
+            // no primary key class, but primary key is enabled. Primary
+            // key columns must be in the base class.
+            FullyQualifiedJavaType keyType = introspectedTable
+                    .getBaseRecordType();
+            topLevelClass.addImportedType(keyType);
+
+            sb.setLength(0);
+            sb.append(keyType.getShortName());
+            sb.append(" key = new "); //$NON-NLS-1$
+            sb.append(keyType.getShortName());
+            sb.append("();"); //$NON-NLS-1$
+            method.addBodyLine(sb.toString());
+
+            for (IntrospectedColumn introspectedColumn : introspectedTable.getPrimaryKeyColumns()) {
+                sb.setLength(0);
+                sb.append("key."); //$NON-NLS-1$
+                sb.append(JavaBeansUtil.getSetterMethodName(introspectedColumn
+                        .getJavaProperty()));
+                sb.append('(');
+                sb.append(introspectedColumn.getJavaProperty());
+                sb.append(");"); //$NON-NLS-1$
+                method.addBodyLine(sb.toString());
+            }
+        }
+
+        sb.setLength(0);
+        sb.append("int rows = "); //$NON-NLS-1$
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        sb.append(daoTemplate.getDeleteMethod(table.getSqlMapNamespace(),
+                XmlConstants.DELETE_BY_PRIMARY_KEY_STATEMENT_ID, "key")); //$NON-NLS-1$
+        method.addBodyLine(sb.toString());
+        method.addBodyLine("return rows;"); //$NON-NLS-1$
+
+        if (ibatorContext.getPlugins().daoDeleteByPrimaryKeyMethodGenerated(method, topLevelClass, introspectedTable)) {
+            topLevelClass.addImportedTypes(importedTypes);
+            topLevelClass.addMethod(method);
+        }
+    }
+
+    public void addInterfaceElements(Interface interfaze) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        
+        if (ibatorContext.getPlugins().daoDeleteByPrimaryKeyMethodGenerated(method, interfaze, introspectedTable)) {
+            interfaze.addImportedTypes(importedTypes);
+            interfaze.addMethod(method);
+        }
+    }
+
+    private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+
+        Method method = new Method();
+        method.setVisibility(JavaVisibility.PUBLIC);
+        method.setReturnType(FullyQualifiedJavaType.getIntInstance());
+        method.setName(getDAOMethodNameCalculator()
+                .getDeleteByPrimaryKeyMethodName(introspectedTable));
+
+        if (introspectedTable.getRules().generatePrimaryKeyClass()) {
+            FullyQualifiedJavaType type = introspectedTable.getPrimaryKeyType();
+            importedTypes.add(type);
+            method.addParameter(new Parameter(type, "key")); //$NON-NLS-1$
+        } else {
+            for (IntrospectedColumn introspectedColumn : introspectedTable.getPrimaryKeyColumns()) {
+                FullyQualifiedJavaType type = introspectedColumn
+                        .getFullyQualifiedJavaType();
+                importedTypes.add(type);
+                method.addParameter(new Parameter(type, introspectedColumn.getJavaProperty()));
+            }
+        }
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            importedTypes.add(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method,
+                table);
+
+        return method;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/InsertMethodGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/InsertMethodGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/InsertMethodGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/InsertMethodGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,147 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ibatis.ibator.api.DAOMethodNameCalculator;
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.IntrospectedColumn;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.PrimitiveTypeWrapper;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class InsertMethodGenerator extends DAOElementGeneratorBaseImpl {
+
+    public InsertMethodGenerator() {
+        super();
+    }
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        
+        FullyQualifiedJavaType returnType = method.getReturnType();
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+
+        StringBuilder sb = new StringBuilder();
+
+        if (returnType != null) {
+            sb.append("Object newKey = "); //$NON-NLS-1$
+        }
+
+        sb.append(daoTemplate.getInsertMethod(table.getSqlMapNamespace(),
+                XmlConstants.INSERT_STATEMENT_ID, "record")); //$NON-NLS-1$
+        method.addBodyLine(sb.toString());
+
+        if (returnType != null) {
+            if ("Object".equals(returnType.getShortName())) { //$NON-NLS-1$
+                // no need to cast if the return type is Object
+                method.addBodyLine("return newKey;"); //$NON-NLS-1$
+            } else {
+                sb.setLength(0);
+
+                if (returnType.isPrimitive()) {
+                    PrimitiveTypeWrapper ptw = returnType
+                            .getPrimitiveTypeWrapper();
+                    sb.append("return (("); //$NON-NLS-1$
+                    sb.append(ptw.getShortName());
+                    sb.append(") newKey"); //$NON-NLS-1$
+                    sb.append(")."); //$NON-NLS-1$
+                    sb.append(ptw.getToPrimitiveMethod());
+                    sb.append(';');
+                } else {
+                    sb.append("return ("); //$NON-NLS-1$
+                    sb.append(returnType.getShortName());
+                    sb.append(") newKey;"); //$NON-NLS-1$
+                }
+
+                method.addBodyLine(sb.toString());
+            }
+        }
+        
+        if (ibatorContext.getPlugins().daoInsertMethodGenerated(method, topLevelClass, introspectedTable)) {
+            topLevelClass.addImportedTypes(importedTypes);
+            topLevelClass.addMethod(method);
+        }
+    }
+    
+    public void addInterfaceElements(Interface interfaze) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        
+        if (ibatorContext.getPlugins().daoInsertMethodGenerated(method, interfaze, introspectedTable)) {
+            interfaze.addImportedTypes(importedTypes);
+            interfaze.addMethod(method);
+        }
+    }
+    
+    private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        Method method = new Method();
+
+        FullyQualifiedJavaType returnType;
+        if (introspectedTable.getGeneratedKey() != null) {
+            IntrospectedColumn introspectedColumn = introspectedTable.getColumn(introspectedTable
+                    .getGeneratedKey().getColumn());
+            if (introspectedColumn == null) {
+                // the specified column doesn't exist, so don't do the generated
+                // key
+                // (the warning has already been reported)
+                returnType = null;
+            } else {
+                returnType = introspectedColumn
+                        .getFullyQualifiedJavaType();
+                importedTypes.add(returnType);
+            }
+        } else {
+            returnType = null;
+        }
+        
+        method.setReturnType(returnType);
+        method.setVisibility(JavaVisibility.PUBLIC);
+        DAOMethodNameCalculator methodNameCalculator = getDAOMethodNameCalculator();
+        method.setName(methodNameCalculator
+                .getInsertMethodName(introspectedTable));
+
+        FullyQualifiedJavaType parameterType = introspectedTable.getRules()
+                .calculateAllFieldsClass();
+
+        importedTypes.add(parameterType);
+        method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            importedTypes.add(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method,
+                table);
+
+        return method;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/InsertSelectiveMethodGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/InsertSelectiveMethodGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/InsertSelectiveMethodGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/InsertSelectiveMethodGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,142 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.IntrospectedColumn;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.PrimitiveTypeWrapper;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class InsertSelectiveMethodGenerator extends DAOElementGeneratorBaseImpl {
+
+    public InsertSelectiveMethodGenerator() {
+        super();
+    }
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType returnType = method.getReturnType();
+        StringBuilder sb = new StringBuilder();
+
+        if (returnType != null) {
+            sb.append("Object newKey = "); //$NON-NLS-1$
+        }
+
+        sb.append(daoTemplate.getInsertMethod(table.getSqlMapNamespace(),
+                XmlConstants.INSERT_SELECTIVE_STATEMENT_ID, "record")); //$NON-NLS-1$
+        method.addBodyLine(sb.toString());
+
+        if (returnType != null) {
+            if ("Object".equals(returnType.getShortName())) { //$NON-NLS-1$
+                // no need to cast if the return type is Object
+                method.addBodyLine("return newKey;"); //$NON-NLS-1$
+            } else {
+                sb.setLength(0);
+
+                if (returnType.isPrimitive()) {
+                    PrimitiveTypeWrapper ptw = returnType
+                            .getPrimitiveTypeWrapper();
+                    sb.append("return (("); //$NON-NLS-1$
+                    sb.append(ptw.getShortName());
+                    sb.append(") newKey"); //$NON-NLS-1$
+                    sb.append(")."); //$NON-NLS-1$
+                    sb.append(ptw.getToPrimitiveMethod());
+                    sb.append(';');
+                } else {
+                    sb.append("return ("); //$NON-NLS-1$
+                    sb.append(returnType.getShortName());
+                    sb.append(") newKey;"); //$NON-NLS-1$
+                }
+
+                method.addBodyLine(sb.toString());
+            }
+        }
+
+        if (ibatorContext.getPlugins().daoInsertSelectiveMethodGenerated(method, topLevelClass, introspectedTable)) {
+            topLevelClass.addImportedTypes(importedTypes);
+            topLevelClass.addMethod(method);
+        }
+    }
+
+    public void addInterfaceElements(Interface interfaze) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        
+        if (ibatorContext.getPlugins().daoInsertSelectiveMethodGenerated(method, interfaze, introspectedTable)) {
+            interfaze.addImportedTypes(importedTypes);
+            interfaze.addMethod(method);
+        }
+    }
+    
+    private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        Method method = new Method();
+
+        FullyQualifiedJavaType returnType;
+        if (introspectedTable.getGeneratedKey() != null) {
+            IntrospectedColumn introspectedColumn = introspectedTable.getColumn(introspectedTable
+                    .getGeneratedKey().getColumn());
+            if (introspectedColumn == null) {
+                // the specified column doesn't exist, so don't do the generated
+                // key
+                // (the warning has already been reported)
+                returnType = null;
+            } else {
+                returnType = introspectedColumn.getFullyQualifiedJavaType();
+                importedTypes.add(returnType);
+            }
+        } else {
+            returnType = null;
+        }
+        method.setReturnType(returnType);
+        method.setVisibility(JavaVisibility.PUBLIC);
+        method.setName(getDAOMethodNameCalculator()
+                .getInsertSelectiveMethodName(introspectedTable));
+
+        FullyQualifiedJavaType parameterType = introspectedTable.getRules()
+                .calculateAllFieldsClass();
+
+        importedTypes.add(parameterType);
+        method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            importedTypes.add(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method,
+                table);
+
+        return method;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithBLOBsMethodGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithBLOBsMethodGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithBLOBsMethodGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithBLOBsMethodGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,120 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class SelectByExampleWithBLOBsMethodGenerator extends
+        DAOElementGeneratorBaseImpl {
+
+    private boolean generateForJava5;
+    
+    public SelectByExampleWithBLOBsMethodGenerator(boolean generateForJava5) {
+        super();
+        this.generateForJava5 = generateForJava5;
+    }
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+
+        if (generateForJava5) {
+            method.addSuppressTypeWarningsAnnotation();
+        }
+
+        StringBuilder sb = new StringBuilder();
+        sb.append(method.getReturnType().getShortName());
+        sb.append(" list = "); //$NON-NLS-1$
+        sb.append(daoTemplate.getQueryForListMethod(table.getSqlMapNamespace(),
+                XmlConstants.SELECT_BY_EXAMPLE_WITH_BLOBS_STATEMENT_ID,
+                "example")); //$NON-NLS-1$
+        method.addBodyLine(sb.toString());
+        method.addBodyLine("return list;"); //$NON-NLS-1$
+
+        if (ibatorContext.getPlugins().daoSelectByExampleWithBLOBsMethodGenerated(method, topLevelClass, introspectedTable)) {
+            topLevelClass.addImportedTypes(importedTypes);
+            topLevelClass.addMethod(method);
+        }
+    }
+
+    public void addInterfaceElements(Interface interfaze) {
+        if (getExampleMethodVisibility() == JavaVisibility.PUBLIC) {
+            Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+            Method method = getMethodShell(importedTypes);
+            
+            if (ibatorContext.getPlugins().daoSelectByExampleWithBLOBsMethodGenerated(method, interfaze, introspectedTable)) {
+                interfaze.addImportedTypes(importedTypes);
+                interfaze.addMethod(method);
+            }
+        }
+    }
+
+    private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType type = introspectedTable.getExampleType();
+        importedTypes.add(type);
+        importedTypes.add(FullyQualifiedJavaType.getNewListInstance());
+
+        Method method = new Method();
+        method.setVisibility(getExampleMethodVisibility());
+
+        FullyQualifiedJavaType returnType = FullyQualifiedJavaType
+                .getNewListInstance();
+        if (generateForJava5) {
+            FullyQualifiedJavaType fqjt;
+            if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
+                fqjt = introspectedTable.getRecordWithBLOBsType();
+            } else {
+                // the blob fields must be rolled up into the base class
+                fqjt = introspectedTable.getBaseRecordType();
+            }
+
+            importedTypes.add(fqjt);
+            returnType.addTypeArgument(fqjt);
+        }
+        method.setReturnType(returnType);
+
+        method.setName(getDAOMethodNameCalculator()
+                .getSelectByExampleWithBLOBsMethodName(introspectedTable));
+        method.addParameter(new Parameter(type, "example")); //$NON-NLS-1$
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            importedTypes.add(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method,
+                table);
+
+        return method;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithoutBLOBsMethodGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithoutBLOBsMethodGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithoutBLOBsMethodGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByExampleWithoutBLOBsMethodGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,124 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+import org.apache.ibatis.ibator.internal.util.messages.Messages;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class SelectByExampleWithoutBLOBsMethodGenerator extends
+        DAOElementGeneratorBaseImpl {
+
+    private boolean generateForJava5;
+
+    public SelectByExampleWithoutBLOBsMethodGenerator(boolean generateForJava5) {
+        super();
+        this.generateForJava5 = generateForJava5;
+    }
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+
+        if (generateForJava5) {
+            method.addSuppressTypeWarningsAnnotation();
+        }
+
+        StringBuilder sb = new StringBuilder();
+        sb.append(method.getReturnType().getShortName());
+        sb.append(" list = "); //$NON-NLS-1$
+        sb.append(daoTemplate.getQueryForListMethod(table.getSqlMapNamespace(),
+                XmlConstants.SELECT_BY_EXAMPLE_STATEMENT_ID, "example")); //$NON-NLS-1$
+        method.addBodyLine(sb.toString());
+        method.addBodyLine("return list;"); //$NON-NLS-1$
+
+        if (ibatorContext.getPlugins().daoSelectByExampleWithoutBLOBsMethodGenerated(method, topLevelClass, introspectedTable)) {
+            topLevelClass.addImportedTypes(importedTypes);
+            topLevelClass.addMethod(method);
+        }
+    }
+
+    public void addInterfaceElements(Interface interfaze) {
+        if (getExampleMethodVisibility() == JavaVisibility.PUBLIC) {
+            Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+            Method method = getMethodShell(importedTypes);
+            
+            if (ibatorContext.getPlugins().daoSelectByExampleWithoutBLOBsMethodGenerated(method, interfaze, introspectedTable)) {
+                interfaze.addImportedTypes(importedTypes);
+                interfaze.addMethod(method);
+            }
+        }
+    }
+
+    private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType type = introspectedTable.getExampleType();
+        importedTypes.add(type);
+        importedTypes.add(FullyQualifiedJavaType.getNewListInstance());
+
+        Method method = new Method();
+        method.setVisibility(getExampleMethodVisibility());
+
+        FullyQualifiedJavaType returnType = FullyQualifiedJavaType
+                .getNewListInstance();
+        ;
+        if (generateForJava5) {
+            FullyQualifiedJavaType fqjt;
+            if (introspectedTable.getRules().generateBaseRecordClass()) {
+                fqjt = introspectedTable.getBaseRecordType();
+            } else if (introspectedTable.getRules().generatePrimaryKeyClass()) {
+                fqjt = introspectedTable.getPrimaryKeyType();
+            } else {
+                throw new RuntimeException(Messages
+                        .getString("RuntimeError.12")); //$NON-NLS-1$
+            }
+
+            importedTypes.add(fqjt);
+            returnType.addTypeArgument(fqjt);
+        }
+
+        method.setReturnType(returnType);
+
+        method.setName(getDAOMethodNameCalculator()
+                .getSelectByExampleWithoutBLOBsMethodName(introspectedTable));
+        method.addParameter(new Parameter(type, "example")); //$NON-NLS-1$
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            importedTypes.add(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method,
+                table);
+
+        return method;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByPrimaryKeyMethodGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByPrimaryKeyMethodGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByPrimaryKeyMethodGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/SelectByPrimaryKeyMethodGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,142 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.IntrospectedColumn;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+import org.apache.ibatis.ibator.internal.util.JavaBeansUtil;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class SelectByPrimaryKeyMethodGenerator extends DAOElementGeneratorBaseImpl {
+
+    public SelectByPrimaryKeyMethodGenerator() {
+        super();
+    }
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+
+        // generate the implementation method
+        StringBuilder sb = new StringBuilder();
+
+        if (!introspectedTable.getRules().generatePrimaryKeyClass()) {
+            // no primary key class, but primary key is enabled. Primary
+            // key columns must be in the base class.
+            FullyQualifiedJavaType keyType = introspectedTable
+                    .getBaseRecordType();
+            topLevelClass.addImportedType(keyType);
+
+            sb.setLength(0);
+            sb.append(keyType.getShortName());
+            sb.append(" key = new "); //$NON-NLS-1$
+            sb.append(keyType.getShortName());
+            sb.append("();"); //$NON-NLS-1$
+            method.addBodyLine(sb.toString());
+
+            for (IntrospectedColumn introspectedColumn : introspectedTable.getPrimaryKeyColumns()) {
+                sb.setLength(0);
+                sb.append("key."); //$NON-NLS-1$
+                sb.append(JavaBeansUtil.getSetterMethodName(introspectedColumn
+                        .getJavaProperty()));
+                sb.append('(');
+                sb.append(introspectedColumn.getJavaProperty());
+                sb.append(");"); //$NON-NLS-1$
+                method.addBodyLine(sb.toString());
+            }
+        }
+
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType returnType = method.getReturnType();
+
+        sb.setLength(0);
+        sb.append(returnType.getShortName());
+        sb.append(" record = ("); //$NON-NLS-1$
+        sb.append(returnType.getShortName());
+        sb.append(") "); //$NON-NLS-1$
+        sb.append(daoTemplate.getQueryForObjectMethod(table
+                .getSqlMapNamespace(),
+                XmlConstants.SELECT_BY_PRIMARY_KEY_STATEMENT_ID, "key")); //$NON-NLS-1$
+        method.addBodyLine(sb.toString());
+        method.addBodyLine("return record;"); //$NON-NLS-1$
+
+        if (ibatorContext.getPlugins().daoSelectByPrimaryKeyMethodGenerated(method, topLevelClass, introspectedTable)) {
+            topLevelClass.addImportedTypes(importedTypes);
+            topLevelClass.addMethod(method);
+        }
+    }
+
+    public void addInterfaceElements(Interface interfaze) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        
+        if (ibatorContext.getPlugins().daoSelectByPrimaryKeyMethodGenerated(method, interfaze, introspectedTable)) {
+            interfaze.addImportedTypes(importedTypes);
+            interfaze.addMethod(method);
+        }
+    }
+    
+    private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+
+        Method method = new Method();
+        method.setVisibility(JavaVisibility.PUBLIC);
+
+        FullyQualifiedJavaType returnType = introspectedTable.getRules()
+                .calculateAllFieldsClass();
+        method.setReturnType(returnType);
+        importedTypes.add(returnType);
+
+        method.setName(getDAOMethodNameCalculator()
+                .getSelectByPrimaryKeyMethodName(introspectedTable));
+
+        if (introspectedTable.getRules().generatePrimaryKeyClass()) {
+            FullyQualifiedJavaType type = introspectedTable.getPrimaryKeyType();
+            importedTypes.add(type);
+            method.addParameter(new Parameter(type, "key")); //$NON-NLS-1$
+        } else {
+            for (IntrospectedColumn introspectedColumn : introspectedTable.getPrimaryKeyColumns()) {
+                FullyQualifiedJavaType type = introspectedColumn.getFullyQualifiedJavaType();
+                importedTypes.add(type);
+                method.addParameter(new Parameter(type, introspectedColumn.getJavaProperty()));
+            }
+        }
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            importedTypes.add(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method,
+                table);
+
+        return method;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleParmsInnerclassGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleParmsInnerclassGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleParmsInnerclassGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleParmsInnerclassGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,87 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.dom.java.Field;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.InnerClass;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class UpdateByExampleParmsInnerclassGenerator extends
+        DAOElementGeneratorBaseImpl {
+
+    public UpdateByExampleParmsInnerclassGenerator() {
+        super();
+    }
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        topLevelClass.addImportedType(introspectedTable.getExampleType());
+        
+        InnerClass innerClass = new InnerClass(
+                new FullyQualifiedJavaType("UpdateByExampleParms")); //$NON-NLS-1$
+        innerClass.setVisibility(JavaVisibility.PRIVATE);
+        innerClass.setStatic(true);
+        innerClass.setSuperClass(introspectedTable.getExampleType());
+        ibatorContext.getCommentGenerator().addClassComment(innerClass, table);
+        
+        Method method = new Method();
+        method.setConstructor(true);
+        method.setVisibility(JavaVisibility.PUBLIC);
+        method.setName(innerClass.getType().getShortName());
+        method.addParameter(
+                new Parameter(FullyQualifiedJavaType.getObjectInstance(),
+                        "record")); //$NON-NLS-1$
+        method.addParameter(
+                new Parameter(introspectedTable.getExampleType(),
+                        "example")); //$NON-NLS-1$
+        method.addBodyLine("super(example);"); //$NON-NLS-1$
+        method.addBodyLine("this.record = record;"); //$NON-NLS-1$
+        innerClass.addMethod(method);
+        
+        Field field = new Field();
+        field.setVisibility(JavaVisibility.PRIVATE);
+        field.setType(FullyQualifiedJavaType.getObjectInstance());
+        field.setName("record"); //$NON-NLS-1$
+        innerClass.addField(field);
+        
+        method = new Method();
+        method.setVisibility(JavaVisibility.PUBLIC);
+        method.setReturnType(FullyQualifiedJavaType.getObjectInstance());
+        method.setName("getRecord"); //$NON-NLS-1$
+        method.addBodyLine("return record;"); //$NON-NLS-1$
+        innerClass.addMethod(method);
+        
+        // TODO - plugin method?
+        
+        topLevelClass.addInnerClass(innerClass);
+    }
+
+    public void addInterfaceElements(Interface interfaze) {
+        // nothing to add to the interface
+        ;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleSelectiveMethodGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleSelectiveMethodGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleSelectiveMethodGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleSelectiveMethodGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,108 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class UpdateByExampleSelectiveMethodGenerator extends
+        DAOElementGeneratorBaseImpl {
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+
+        method
+                .addBodyLine("UpdateByExampleParms parms = new UpdateByExampleParms(record, example);"); //$NON-NLS-1$
+
+        StringBuilder sb = new StringBuilder();
+
+        sb.append("int rows = "); //$NON-NLS-1$
+
+        sb.append(daoTemplate.getUpdateMethod(table.getSqlMapNamespace(),
+                        XmlConstants.UPDATE_BY_EXAMPLE_SELECTIVE_STATEMENT_ID,
+                        "parms")); //$NON-NLS-1$
+        method.addBodyLine(sb.toString());
+
+        method.addBodyLine("return rows;"); //$NON-NLS-1$
+
+        if (ibatorContext.getPlugins().daoUpdateByExampleSelectiveMethodGenerated(method, topLevelClass, introspectedTable)) {
+            topLevelClass.addImportedTypes(importedTypes);
+            topLevelClass.addMethod(method);
+        }
+    }
+
+    public void addInterfaceElements(Interface interfaze) {
+        if (getExampleMethodVisibility() == JavaVisibility.PUBLIC) {
+            Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+            Method method = getMethodShell(importedTypes);
+            
+            if (ibatorContext.getPlugins().daoUpdateByExampleSelectiveMethodGenerated(method, interfaze, introspectedTable)) {
+                interfaze.addImportedTypes(importedTypes);
+                interfaze.addMethod(method);
+            }
+        }
+    }
+
+    private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType parameterType;
+
+        if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
+            parameterType = introspectedTable.getRecordWithBLOBsType();
+        } else if (introspectedTable.getRules().generateBaseRecordClass()) {
+            parameterType = introspectedTable.getBaseRecordType();
+        } else {
+            parameterType = introspectedTable.getPrimaryKeyType();
+        }
+
+        importedTypes.add(parameterType);
+
+        Method method = new Method();
+        method.setVisibility(getExampleMethodVisibility());
+        method.setReturnType(FullyQualifiedJavaType.getIntInstance());
+        method.setName(getDAOMethodNameCalculator()
+                .getUpdateByExampleSelectiveMethodName(introspectedTable));
+        method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
+        method.addParameter(new Parameter(introspectedTable.getExampleType(),
+                "example")); //$NON-NLS-1$
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            importedTypes.add(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method,
+                table);
+
+        return method;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleWithBLOBsMethodGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleWithBLOBsMethodGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleWithBLOBsMethodGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleWithBLOBsMethodGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,103 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class UpdateByExampleWithBLOBsMethodGenerator extends
+        DAOElementGeneratorBaseImpl {
+
+    public UpdateByExampleWithBLOBsMethodGenerator() {
+        super();
+    }
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        
+        method.addBodyLine("UpdateByExampleParms parms = new UpdateByExampleParms(record, example);"); //$NON-NLS-1$
+            
+        StringBuilder sb = new StringBuilder();
+        sb.append("int rows = "); //$NON-NLS-1$
+        sb.append(daoTemplate.getUpdateMethod(table.getSqlMapNamespace(),
+                XmlConstants.UPDATE_BY_EXAMPLE_WITH_BLOBS_STATEMENT_ID,
+                "parms")); //$NON-NLS-1$
+        method.addBodyLine(sb.toString());
+
+        method.addBodyLine("return rows;"); //$NON-NLS-1$
+
+        if (ibatorContext.getPlugins().daoUpdateByExampleWithBLOBsMethodGenerated(method, topLevelClass, introspectedTable)) {
+            topLevelClass.addImportedTypes(importedTypes);
+            topLevelClass.addMethod(method);
+        }
+    }
+
+    public void addInterfaceElements(Interface interfaze) {
+        if (getExampleMethodVisibility() == JavaVisibility.PUBLIC) {
+            Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+            Method method = getMethodShell(importedTypes);
+            
+            if (ibatorContext.getPlugins().daoUpdateByExampleWithBLOBsMethodGenerated(method, interfaze, introspectedTable)) {
+                interfaze.addImportedTypes(importedTypes);
+                interfaze.addMethod(method);
+            }
+        }
+    }
+    
+    private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType parameterType; 
+        if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
+            parameterType = introspectedTable.getRecordWithBLOBsType();
+        } else {
+            parameterType = introspectedTable.getBaseRecordType();
+        }
+
+        importedTypes.add(parameterType);
+
+        Method method = new Method();
+        method.setVisibility(getExampleMethodVisibility());
+        method.setReturnType(FullyQualifiedJavaType.getIntInstance());
+        method.setName(getDAOMethodNameCalculator().getUpdateByExampleWithBLOBsMethodName(introspectedTable));
+        method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
+        method.addParameter(new Parameter(introspectedTable.getExampleType(), "example")); //$NON-NLS-1$
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            importedTypes.add(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method, table);
+
+        return method;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleWithoutBLOBsMethodGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleWithoutBLOBsMethodGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleWithoutBLOBsMethodGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByExampleWithoutBLOBsMethodGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,103 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class UpdateByExampleWithoutBLOBsMethodGenerator extends
+        DAOElementGeneratorBaseImpl {
+
+    public UpdateByExampleWithoutBLOBsMethodGenerator() {
+        super();
+    }
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        
+        method.addBodyLine("UpdateByExampleParms parms = new UpdateByExampleParms(record, example);"); //$NON-NLS-1$
+            
+        StringBuilder sb = new StringBuilder();
+        sb.append("int rows = "); //$NON-NLS-1$
+        sb.append(daoTemplate.getUpdateMethod(table.getSqlMapNamespace(),
+                XmlConstants.UPDATE_BY_EXAMPLE_STATEMENT_ID,
+                "parms")); //$NON-NLS-1$
+        method.addBodyLine(sb.toString());
+
+        method.addBodyLine("return rows;"); //$NON-NLS-1$
+
+        if (ibatorContext.getPlugins().daoUpdateByExampleWithoutBLOBsMethodGenerated(method, topLevelClass, introspectedTable)) {
+            topLevelClass.addImportedTypes(importedTypes);
+            topLevelClass.addMethod(method);
+        }
+    }
+
+    public void addInterfaceElements(Interface interfaze) {
+        if (getExampleMethodVisibility() == JavaVisibility.PUBLIC) {
+            Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+            Method method = getMethodShell(importedTypes);
+            
+            if (ibatorContext.getPlugins().daoUpdateByExampleWithoutBLOBsMethodGenerated(method, interfaze, introspectedTable)) {
+                interfaze.addImportedTypes(importedTypes);
+                interfaze.addMethod(method);
+            }
+        }
+    }
+    
+    private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType parameterType; 
+        if (introspectedTable.getRules().generateBaseRecordClass()) {
+            parameterType = introspectedTable.getBaseRecordType();
+        } else {
+            parameterType = introspectedTable.getPrimaryKeyType();
+        }
+
+        importedTypes.add(parameterType);
+
+        Method method = new Method();
+        method.setVisibility(getExampleMethodVisibility());
+        method.setReturnType(FullyQualifiedJavaType.getIntInstance());
+        method.setName(getDAOMethodNameCalculator().getUpdateByExampleWithoutBLOBsMethodName(introspectedTable));
+        method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
+        method.addParameter(new Parameter(introspectedTable.getExampleType(), "example")); //$NON-NLS-1$
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            importedTypes.add(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method, table);
+
+        return method;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByPrimaryKeySelectiveMethodGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByPrimaryKeySelectiveMethodGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByPrimaryKeySelectiveMethodGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByPrimaryKeySelectiveMethodGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,99 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class UpdateByPrimaryKeySelectiveMethodGenerator extends
+        DAOElementGeneratorBaseImpl {
+
+    public UpdateByPrimaryKeySelectiveMethodGenerator() {
+        super();
+    }
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        
+        StringBuilder sb = new StringBuilder();
+        sb.append("int rows = "); //$NON-NLS-1$
+        sb.append(daoTemplate.getUpdateMethod(table.getSqlMapNamespace(),
+                XmlConstants.UPDATE_BY_PRIMARY_KEY_SELECTIVE_STATEMENT_ID,
+                "record")); //$NON-NLS-1$
+        method.addBodyLine(sb.toString());
+
+        method.addBodyLine("return rows;"); //$NON-NLS-1$
+
+        if (ibatorContext.getPlugins().daoUpdateByPrimaryKeySelectiveMethodGenerated(method, topLevelClass, introspectedTable)) {
+            topLevelClass.addImportedTypes(importedTypes);
+            topLevelClass.addMethod(method);
+        }
+    }
+
+    public void addInterfaceElements(Interface interfaze) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        
+        if (ibatorContext.getPlugins().daoUpdateByPrimaryKeySelectiveMethodGenerated(method, interfaze, introspectedTable)) {
+            interfaze.addImportedTypes(importedTypes);
+            interfaze.addMethod(method);
+        }
+    }
+    
+    private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType parameterType;
+        
+        if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
+            parameterType = introspectedTable.getRecordWithBLOBsType();
+        } else {
+            parameterType = introspectedTable.getBaseRecordType();
+        }
+        
+        importedTypes.add(parameterType);
+
+        Method method = new Method();
+        method.setVisibility(JavaVisibility.PUBLIC);
+        method.setReturnType(FullyQualifiedJavaType.getIntInstance());
+        method.setName(getDAOMethodNameCalculator().getUpdateByPrimaryKeySelectiveMethodName(introspectedTable));
+        method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            importedTypes.add(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method, table);
+
+        return method;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByPrimaryKeyWithBLOBsMethodGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByPrimaryKeyWithBLOBsMethodGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByPrimaryKeyWithBLOBsMethodGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByPrimaryKeyWithBLOBsMethodGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,99 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class UpdateByPrimaryKeyWithBLOBsMethodGenerator extends
+        DAOElementGeneratorBaseImpl {
+
+    public UpdateByPrimaryKeyWithBLOBsMethodGenerator() {
+        super();
+    }
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+
+        StringBuilder sb = new StringBuilder();
+        sb.append("int rows = "); //$NON-NLS-1$
+        sb.append(daoTemplate.getUpdateMethod(table.getSqlMapNamespace(),
+                XmlConstants.UPDATE_BY_PRIMARY_KEY_WITH_BLOBS_STATEMENT_ID,
+                "record")); //$NON-NLS-1$
+        method.addBodyLine(sb.toString());
+
+        method.addBodyLine("return rows;"); //$NON-NLS-1$
+
+        if (ibatorContext.getPlugins().daoUpdateByPrimaryKeyWithBLOBsMethodGenerated(method, topLevelClass, introspectedTable)) {
+            topLevelClass.addImportedTypes(importedTypes);
+            topLevelClass.addMethod(method);
+        }
+    }
+
+    public void addInterfaceElements(Interface interfaze) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+
+        if (ibatorContext.getPlugins().daoUpdateByPrimaryKeyWithBLOBsMethodGenerated(method, interfaze, introspectedTable)) {
+            interfaze.addImportedTypes(importedTypes);
+            interfaze.addMethod(method);
+        }
+    }
+    
+    private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType parameterType;
+        
+        if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
+            parameterType = introspectedTable.getRecordWithBLOBsType();
+        } else {
+            parameterType = introspectedTable.getBaseRecordType();
+        }
+        
+        importedTypes.add(parameterType);
+
+        Method method = new Method();
+        method.setVisibility(JavaVisibility.PUBLIC);
+        method.setReturnType(FullyQualifiedJavaType.getIntInstance());
+        method.setName(getDAOMethodNameCalculator().getUpdateByPrimaryKeyWithBLOBsMethodName(introspectedTable));
+        method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            importedTypes.add(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method, table);
+        
+        return method;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByPrimaryKeyWithoutBLOBsMethodGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByPrimaryKeyWithoutBLOBsMethodGenerator.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByPrimaryKeyWithoutBLOBsMethodGenerator.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/elements/UpdateByPrimaryKeyWithoutBLOBsMethodGenerator.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,93 @@
+/*
+ *  Copyright 2008 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.elements;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Interface;
+import org.apache.ibatis.ibator.api.dom.java.JavaVisibility;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+import org.apache.ibatis.ibator.api.dom.java.TopLevelClass;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class UpdateByPrimaryKeyWithoutBLOBsMethodGenerator extends
+        DAOElementGeneratorBaseImpl {
+
+    public UpdateByPrimaryKeyWithoutBLOBsMethodGenerator() {
+        super();
+    }
+
+    public void addImplementationElements(TopLevelClass topLevelClass) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        
+        StringBuilder sb = new StringBuilder();
+        sb.append("int rows = "); //$NON-NLS-1$
+        sb.append(daoTemplate.getUpdateMethod(table.getSqlMapNamespace(),
+                XmlConstants.UPDATE_BY_PRIMARY_KEY_STATEMENT_ID,
+                "record")); //$NON-NLS-1$
+        method.addBodyLine(sb.toString());
+
+        method.addBodyLine("return rows;"); //$NON-NLS-1$
+
+        if (ibatorContext.getPlugins().daoUpdateByPrimaryKeyWithoutBLOBsMethodGenerated(method, topLevelClass, introspectedTable)) {
+            topLevelClass.addImportedTypes(importedTypes);
+            topLevelClass.addMethod(method);
+        }
+    }
+
+    public void addInterfaceElements(Interface interfaze) {
+        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
+        Method method = getMethodShell(importedTypes);
+        
+        if (ibatorContext.getPlugins().daoUpdateByPrimaryKeyWithoutBLOBsMethodGenerated(method, interfaze, introspectedTable)) {
+            interfaze.addImportedTypes(importedTypes);
+            interfaze.addMethod(method);
+        }
+    }
+    
+    private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType parameterType = 
+            introspectedTable.getBaseRecordType();
+        importedTypes.add(parameterType);
+
+        Method method = new Method();
+        method.setVisibility(JavaVisibility.PUBLIC);
+        method.setReturnType(FullyQualifiedJavaType.getIntInstance());
+        method.setName(getDAOMethodNameCalculator().getUpdateByPrimaryKeyWithoutBLOBsMethodName(introspectedTable));
+        method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            importedTypes.add(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method, table);
+
+        return method;
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/templates/AbstractDAOTemplate.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/templates/AbstractDAOTemplate.java?rev=703569&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/templates/AbstractDAOTemplate.java (added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/dao/templates/AbstractDAOTemplate.java Fri Oct 10 13:08:10 2008
@@ -0,0 +1,304 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.dao.templates;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ibatis.ibator.api.CommentGenerator;
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
+import org.apache.ibatis.ibator.api.dom.java.Field;
+import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
+import org.apache.ibatis.ibator.api.dom.java.Method;
+import org.apache.ibatis.ibator.api.dom.java.Parameter;
+
+/**
+ * @author Jeff Butler
+ */
+public abstract class AbstractDAOTemplate {
+    private List<FullyQualifiedJavaType> interfaceImports;
+
+    private List<FullyQualifiedJavaType> implementationImports;
+
+    private FullyQualifiedJavaType superClass;
+
+    private List<FullyQualifiedJavaType> checkedExceptions;
+
+    private List<Field> fields;
+
+    private List<Method> methods;
+
+    private Method constructorTemplate;
+
+    private String deleteMethodTemplate;
+
+    private String insertMethodTemplate;
+
+    private String updateMethodTemplate;
+
+    private String queryForObjectMethodTemplate;
+
+    private String queryForListMethodTemplate;
+    
+    private boolean configured;
+
+    /**
+     *  
+     */
+    public AbstractDAOTemplate() {
+        super();
+        interfaceImports = new ArrayList<FullyQualifiedJavaType>();
+        implementationImports = new ArrayList<FullyQualifiedJavaType>();
+        fields = new ArrayList<Field>();
+        methods = new ArrayList<Method>();
+        checkedExceptions = new ArrayList<FullyQualifiedJavaType>();
+        configured = false;
+    }
+
+    public final Method getConstructorClone(CommentGenerator commentGenerator, FullyQualifiedJavaType type, FullyQualifiedTable table) {
+        configure();
+        Method answer = new Method();
+        answer.setConstructor(true);
+        answer.setName(type.getShortName());
+        answer.setVisibility(constructorTemplate.getVisibility());
+        for (Parameter parm : constructorTemplate.getParameters()) {
+            answer.addParameter(parm);
+        }
+
+        for (String bodyLine: constructorTemplate.getBodyLines()) {
+            answer.addBodyLine(bodyLine);
+        }
+
+        for (FullyQualifiedJavaType fqjt : constructorTemplate.getExceptions()) {
+            answer.addException(fqjt);
+        }
+        
+        commentGenerator.addGeneralMethodComment(answer, table);
+        
+        return answer;
+    }
+
+    public final String getDeleteMethod(String sqlMapNamespace, String statementId,
+            String parameter) {
+        configure();
+        String answer = MessageFormat.format(deleteMethodTemplate,
+                new Object[] { sqlMapNamespace, statementId, parameter });
+
+        return answer;
+    }
+
+    public final List<FullyQualifiedJavaType> getInterfaceImports() {
+        configure();
+        return interfaceImports;
+    }
+
+    public final List<FullyQualifiedJavaType> getImplementationImports() {
+        configure();
+        return implementationImports;
+    }
+
+    public final String getInsertMethod(String sqlMapNamespace, String statementId,
+            String parameter) {
+        configure();
+        String answer = MessageFormat.format(insertMethodTemplate,
+                new Object[] { sqlMapNamespace, statementId, parameter });
+
+        return answer;
+    }
+
+    public final String getQueryForListMethod(String sqlMapNamespace, String statementId,
+            String parameter) {
+        configure();
+        String answer = MessageFormat.format(queryForListMethodTemplate,
+                new Object[] { sqlMapNamespace, statementId, parameter });
+
+        return answer;
+    }
+
+    public final String getQueryForObjectMethod(String sqlMapNamespace, String statementId,
+            String parameter) {
+        configure();
+        String answer = MessageFormat.format(queryForObjectMethodTemplate,
+                new Object[] { sqlMapNamespace, statementId, parameter });
+
+        return answer;
+    }
+
+    public final FullyQualifiedJavaType getSuperClass() {
+        configure();
+        return superClass;
+    }
+
+    public final String getUpdateMethod(String sqlMapNamespace, String statementId,
+            String parameter) {
+        configure();
+        String answer = MessageFormat.format(updateMethodTemplate,
+                new Object[] { sqlMapNamespace, statementId, parameter });
+
+        return answer;
+    }
+
+    public final List<FullyQualifiedJavaType> getCheckedExceptions() {
+        configure();
+        return checkedExceptions;
+    }
+
+    public final List<Field> getFieldClones(CommentGenerator commentGenerator, FullyQualifiedTable table) {
+        configure();
+        List<Field> answer = new ArrayList<Field>();
+        for (Field oldField : fields) {
+            Field field = new Field();
+            
+            field.setInitializationString(oldField.getInitializationString());
+            field.setFinal(oldField.isFinal());
+            field.setStatic(oldField.isStatic());
+            field.setName(oldField.getName());
+            field.setType(oldField.getType());
+            field.setVisibility(oldField.getVisibility());
+            commentGenerator.addFieldComment(field, table);
+            answer.add(field);
+        }
+        
+        return answer;
+    }
+
+    public final List<Method> getMethodClones(CommentGenerator commentGenerator, FullyQualifiedTable table) {
+        configure();
+        List<Method> answer = new ArrayList<Method>();
+        for (Method oldMethod : methods) {
+            Method method = new Method();
+
+            for (String bodyLine : oldMethod.getBodyLines()) {
+                method.addBodyLine(bodyLine);
+            }
+            
+            for (FullyQualifiedJavaType fqjt : oldMethod.getExceptions()) {
+                method.addException(fqjt);
+            }
+
+            for (Parameter parm : oldMethod.getParameters()) {
+                method.addParameter(parm);
+            }
+            
+            method.setConstructor(oldMethod.isConstructor());
+            method.setFinal(oldMethod.isFinal());
+            method.setStatic(oldMethod.isStatic());
+            method.setName(oldMethod.getName());
+            method.setReturnType(oldMethod.getReturnType());
+            method.setVisibility(oldMethod.getVisibility());
+            
+            commentGenerator.addGeneralMethodComment(method, table);
+            
+            answer.add(method);
+        }
+        
+        return answer;
+    }
+
+    protected void setConstructorTemplate(Method constructorTemplate) {
+        this.constructorTemplate = constructorTemplate;
+    }
+
+    protected void setDeleteMethodTemplate(String deleteMethodTemplate) {
+        this.deleteMethodTemplate = deleteMethodTemplate;
+    }
+
+    protected void addField(Field field) {
+        fields.add(field);
+    }
+
+    protected void setInsertMethodTemplate(String insertMethodTemplate) {
+        this.insertMethodTemplate = insertMethodTemplate;
+    }
+
+    protected void addMethod(Method method) {
+        methods.add(method);
+    }
+
+    protected void setQueryForListMethodTemplate(String queryForListMethodTemplate) {
+        this.queryForListMethodTemplate = queryForListMethodTemplate;
+    }
+
+    protected void setQueryForObjectMethodTemplate(String queryForObjectMethodTemplate) {
+        this.queryForObjectMethodTemplate = queryForObjectMethodTemplate;
+    }
+
+    protected void setSuperClass(FullyQualifiedJavaType superClass) {
+        this.superClass = superClass;
+    }
+
+    protected void setUpdateMethodTemplate(String updateMethodTemplate) {
+        this.updateMethodTemplate = updateMethodTemplate;
+    }
+
+    protected void addInterfaceImport(FullyQualifiedJavaType type) {
+        interfaceImports.add(type);
+    }
+
+    protected void addImplementationImport(FullyQualifiedJavaType type) {
+        implementationImports.add(type);
+    }
+
+    protected void addCheckedException(FullyQualifiedJavaType type) {
+        checkedExceptions.add(type);
+    }
+    
+    /**
+     * This method is called in the constructor to configure the DAO template.
+     * Subclasses should implement the individual configureXXX methods to
+     * setup the relevant parts of the DAO template (super class,
+     * extra methods, etc.) that are relevant for this specific type of DAO.
+     */
+    private void configure() {
+        if (!configured) {
+            configureCheckedExceptions();
+            configureConstructorTemplate();
+            configureDeleteMethodTemplate();
+            configureFields();
+            configureImplementationImports();
+            configureInsertMethodTemplate();
+            configureInterfaceImports();
+            configureMethods();
+            configureQueryForListMethodTemplate();
+            configureQueryForObjectMethodTemplate();
+            configureSuperClass();
+            configureUpdateMethodTemplate();
+            configured = true;
+        }
+    }
+    
+    // TODO - fully document each of these methods
+    protected void configureCheckedExceptions() {
+    }
+    protected void configureFields() {
+    }
+    protected void configureImplementationImports() {
+    }
+    protected void configureInterfaceImports() {
+    }
+    protected void configureMethods() {
+    }
+    protected void configureSuperClass() {
+    }
+
+    protected abstract void configureInsertMethodTemplate();
+    protected abstract void configureQueryForListMethodTemplate();
+    protected abstract void configureQueryForObjectMethodTemplate();
+    protected abstract void configureUpdateMethodTemplate();
+    protected abstract void configureConstructorTemplate();
+    protected abstract void configureDeleteMethodTemplate();
+}