Get ID after INSERT, otherwise error because I am not using SEQUENCES.
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sat, 27 Dec 2014 23:34:37 +0000 (00:34 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sat, 27 Dec 2014 23:34:37 +0000 (00:34 +0100)
MyBatis/MyBatis-Spring/src/main/resources/generator/generatorConfig.xml
MyBatis/MyBatis/src/main/resources/generator/generatorConfig.xml

index 3fc63b3..978cf3e 100644 (file)
@@ -63,7 +63,7 @@
             <mybatis:scan/> supports filtering the mappers created by either specifying a marker interface or an annotation
             -->
             <property name="rootInterface" value="de.example.mybatis.mapper.filter.MyBatisScanFilter" />
-            <generatedKey column="id" sqlStatement="MySql" identity="false" type="pre" />
+            <generatedKey column="id" sqlStatement="MySql" identity="true" type="post" />
         </table>
         <table schema="mybatis_example" tableName="ad_description" domainObjectName="AdDescription">
             <property name="useActualColumnNames" value="false" />
@@ -72,7 +72,7 @@
             <mybatis:scan/> supports filtering the mappers created by either specifying a marker interface or an annotation
             -->
             <property name="rootInterface" value="de.example.mybatis.mapper.filter.MyBatisScanFilter" />
-            <generatedKey column="id" sqlStatement="MySql" identity="false" type="pre" />
+            <generatedKey column="id" sqlStatement="MySql" identity="true" type="post" />
         </table>
     </context>
 </generatorConfiguration>
index 652403a..e4168c7 100644 (file)
         <table schema="mybatis_example" tableName="ad" domainObjectName="Ad">
             <property name="useActualColumnNames" value="false" />
             <property name="ignoreQualifiersAtRuntime" value="true" />
-            <generatedKey column="id" sqlStatement="MySql" identity="false" type="pre" />
+            <generatedKey column="id" sqlStatement="MySql" identity="true" type="post" />
         </table>
         <table schema="mybatis_example" tableName="ad_description" domainObjectName="AdDescription">
             <property name="useActualColumnNames" value="false" />
             <property name="ignoreQualifiersAtRuntime" value="true" />
-            <generatedKey column="id" sqlStatement="MySql" identity="false" type="pre" />
+            <generatedKey column="id" sqlStatement="MySql" identity="true" type="post" />
         </table>
     </context>
 </generatorConfiguration>