There is method for flushing(executing) batch update statements that stored in a JDBC driver class at any timing. This method can be used when you use the ExecutorType.BATCH as ExecutorType.
+ flushStatements()]]>
+
+
事务控制方法
控制事务范围有四个方法。
@@ -800,6 +805,12 @@ type,method。type 属性是类的完全限
will use a result handler, the return type must be void and this annotation (or @ResultMap)
is required. This annotation is ignored unless the method return type is void.
+
+
@Flush
+
Method
+
N/A
+
If this annotation is used, it can be called the SqlSession#flushStatements() via method defined at a Mapper interface.(MyBatis 3.3 or above)
This example shows using the @Flush annotation to call the SqlSession#flushStatements():
+ flush();]]>
diff --git a/src/test/java/org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml b/src/test/java/org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml
index 539471226..9467e18aa 100644
--- a/src/test/java/org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml
+++ b/src/test/java/org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml
@@ -23,6 +23,10 @@
+
+
+
+
@@ -38,13 +42,14 @@
-
+
+
diff --git a/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java b/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java
index d6aefdf52..18c7d3eaa 100644
--- a/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java
+++ b/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java
@@ -28,6 +28,7 @@
import org.apache.ibatis.builder.xml.XMLConfigBuilder;
import org.apache.ibatis.executor.loader.cglib.CglibProxyFactory;
import org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory;
+import org.apache.ibatis.io.JBoss6VFS;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.logging.slf4j.Slf4jImpl;
import org.apache.ibatis.scripting.defaults.RawLanguageDriver;
@@ -164,6 +165,7 @@ public void shouldSuccessfullyLoadXMLConfigFile() throws Exception {
assertThat(config.isCallSettersOnNulls(), is(true));
assertThat(config.getLogPrefix(), is("mybatis_"));
assertThat(config.getLogImpl().getName(), is(Slf4jImpl.class.getName()));
+ assertThat(config.getVfsImpl().getName(), is(JBoss6VFS.class.getName()));
assertThat(config.getConfigurationFactory().getName(), is(String.class.getName()));
}
diff --git a/src/test/java/org/apache/ibatis/builder/xml/dynamic/DynamicSqlSourceTest.java b/src/test/java/org/apache/ibatis/builder/xml/dynamic/DynamicSqlSourceTest.java
index bdba78579..07b9bad68 100644
--- a/src/test/java/org/apache/ibatis/builder/xml/dynamic/DynamicSqlSourceTest.java
+++ b/src/test/java/org/apache/ibatis/builder/xml/dynamic/DynamicSqlSourceTest.java
@@ -317,6 +317,17 @@ public void shouldIterateOnceForEachItemInCollection() throws Exception {
assertEquals("__frch_item_2", boundSql.getParameterMappings().get(2).getProperty());
}
+ @Test
+ public void shouldHandleOgnlExpression() throws Exception {
+ final HashMap parameterObject = new HashMap() {{
+ put("name", "Steve");
+ }};
+ final String expected = "Expression test: 3 / yes.";
+ DynamicSqlSource source = createDynamicSqlSource(new TextSqlNode("Expression test: ${name.indexOf('v')} / ${name in {'Bob', 'Steve'\\} ? 'yes' : 'no'}."));
+ BoundSql boundSql = source.getBoundSql(parameterObject);
+ assertEquals(expected, boundSql.getSql());
+ }
+
@Test
public void shouldSkipForEachWhenCollectionIsEmpty() throws Exception {
final HashMap parameterObject = new HashMap() {{
diff --git a/src/test/java/org/apache/ibatis/executor/ExecutorTestHelper.java b/src/test/java/org/apache/ibatis/executor/ExecutorTestHelper.java
index b40a6609c..baadf3a22 100644
--- a/src/test/java/org/apache/ibatis/executor/ExecutorTestHelper.java
+++ b/src/test/java/org/apache/ibatis/executor/ExecutorTestHelper.java
@@ -197,7 +197,7 @@ public static MappedStatement prepareSelectAllAuthorsAutoMappedStatement(final C
}
}).build());
}
- }).fetchSize(1000).build();
+ }).fetchSize(1000).timeout(2000).build();
}
public static MappedStatement prepareSelectOneAuthorMappedStatementWithConstructorResults(final Configuration config) {
diff --git a/src/test/java/org/apache/ibatis/mapping/BoundSqlTest.java b/src/test/java/org/apache/ibatis/mapping/BoundSqlTest.java
new file mode 100644
index 000000000..439fbbf94
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/mapping/BoundSqlTest.java
@@ -0,0 +1,59 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.mapping;
+
+import static org.junit.Assert.*;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.session.Configuration;
+import org.junit.Test;
+
+public class BoundSqlTest {
+
+ @Test
+ public void testHasAdditionalParameter() throws Exception {
+ List params = Collections.emptyList();
+ BoundSql boundSql = new BoundSql(new Configuration(), "some sql", params, new Object());
+
+ Map map = new HashMap();
+ map.put("key1", "value1");
+ boundSql.setAdditionalParameter("map", map);
+
+ Person bean = new Person();
+ bean.id = 1;
+ boundSql.setAdditionalParameter("person", bean);
+
+ assertFalse(boundSql.hasAdditionalParameter("pet"));
+ assertFalse(boundSql.hasAdditionalParameter("pet.name"));
+
+ assertTrue(boundSql.hasAdditionalParameter("map"));
+ assertTrue(boundSql.hasAdditionalParameter("map.key1"));
+ assertTrue("should return true even if the child property does not exists.", boundSql.hasAdditionalParameter("map.key2"));
+
+ assertTrue(boundSql.hasAdditionalParameter("person"));
+ assertTrue(boundSql.hasAdditionalParameter("person.id"));
+ assertTrue("should return true even if the child property does not exists.", boundSql.hasAdditionalParameter("person.name"));
+ }
+
+ public static class Person {
+ public Integer id;
+ }
+
+}
diff --git a/src/test/java/org/apache/ibatis/parsing/GenericTokenParserTest.java b/src/test/java/org/apache/ibatis/parsing/GenericTokenParserTest.java
index a81f510ea..404062bd9 100644
--- a/src/test/java/org/apache/ibatis/parsing/GenericTokenParserTest.java
+++ b/src/test/java/org/apache/ibatis/parsing/GenericTokenParserTest.java
@@ -42,6 +42,7 @@ public void shouldDemonstrateGenericTokenReplacement() {
put("first_name", "James");
put("initial", "T");
put("last_name", "Kirk");
+ put("var{with}brace", "Hiya");
put("", "");
}
}));
@@ -61,6 +62,9 @@ public void shouldDemonstrateGenericTokenReplacement() {
assertEquals("{$$something}JamesTKirk", parser.parse("{$$something}${first_name}${initial}${last_name}"));
assertEquals("${", parser.parse("${"));
+ assertEquals("${\\}", parser.parse("${\\}"));
+ assertEquals("Hiya", parser.parse("${var{with\\}brace}"));
+ assertEquals("", parser.parse("${}"));
assertEquals("}", parser.parse("}"));
assertEquals("Hello ${ this is a test.", parser.parse("Hello ${ this is a test."));
assertEquals("Hello } this is a test.", parser.parse("Hello } this is a test."));
diff --git a/src/test/java/org/apache/ibatis/submitted/emptycollection/Dao.java b/src/test/java/org/apache/ibatis/submitted/emptycollection/Dao.java
new file mode 100644
index 000000000..f7aa7fd83
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/emptycollection/Dao.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.emptycollection;
+
+import java.util.List;
+
+interface Dao {
+ List selectWithEmptyList();
+ List selectWithNonEmptyList();
+ List selectWithNonEmptyList_noCollectionId();
+}
diff --git a/src/test/java/org/apache/ibatis/submitted/emptycollection/Dao.xml b/src/test/java/org/apache/ibatis/submitted/emptycollection/Dao.xml
new file mode 100644
index 000000000..d3c8766d6
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/emptycollection/Dao.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/org/apache/ibatis/submitted/emptycollection/DaoTest.java b/src/test/java/org/apache/ibatis/submitted/emptycollection/DaoTest.java
new file mode 100644
index 000000000..e42c823f6
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/emptycollection/DaoTest.java
@@ -0,0 +1,93 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.emptycollection;
+
+import java.io.Reader;
+import java.sql.Connection;
+import java.util.List;
+
+import org.apache.ibatis.io.Resources;
+import org.apache.ibatis.jdbc.ScriptRunner;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.apache.ibatis.session.SqlSessionFactoryBuilder;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DaoTest {
+ private Dao dao;
+ private SqlSession sqlSession;
+
+ @Before
+ public void setUp() throws Exception {
+ Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/emptycollection/mybatis-config.xml");
+ SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
+ reader.close();
+
+ sqlSession = sqlSessionFactory.openSession();
+ Connection conn = sqlSession.getConnection();
+ ScriptRunner runner = new ScriptRunner(conn);
+ runner.setLogWriter(null);
+ dao = sqlSession.getMapper(Dao.class);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ sqlSession.close();
+ }
+
+ @Test
+ public void testWithEmptyList() throws Exception {
+ final List actual = dao.selectWithEmptyList();
+ Assert.assertEquals(1, actual.size());
+ final List todoItems = actual.get(0).getTodoItems();
+ Assert.assertEquals("expect " + todoItems + " to be empty", 0, todoItems.size());
+ }
+
+ @Test
+ public void testWithNonEmptyList() throws Exception {
+ final List actual = dao.selectWithNonEmptyList();
+ checkNonEmptyList(actual);
+ }
+
+ @Test
+ public void testWithNonEmptyList_noCollectionId() throws Exception {
+ final List actual = dao.selectWithNonEmptyList_noCollectionId();
+
+ checkNonEmptyList(actual);
+ }
+
+ private void checkNonEmptyList(final List actual) {
+// Assert.assertEquals("[List(1)=[a description(1), a 2nd description(2)], List(2)=[a description(1)]]", actual.toString());
+ Assert.assertEquals(2, actual.size());
+
+ Assert.assertEquals(2, actual.get(0).getTodoItems().size());
+ Assert.assertEquals(1, actual.get(0).getTodoItems().get(0).getOrder());
+ Assert.assertEquals("a description", actual.get(0).getTodoItems().get(0).getDescription().trim());
+ Assert.assertEquals(2, actual.get(0).getTodoItems().get(1).getOrder());
+ Assert.assertEquals("a 2nd description", actual.get(0).getTodoItems().get(1).getDescription().trim());
+
+ Assert.assertEquals(1, actual.get(1).getTodoItems().size());
+ Assert.assertEquals(1, actual.get(1).getTodoItems().get(0).getOrder());
+ Assert.assertEquals("a description", actual.get(0).getTodoItems().get(0).getDescription().trim());
+
+ // We should have gotten three item objects. The first item from the first list and the first item from
+ // the second list have identical properties, but they should be distinct objects
+ Assert.assertNotSame(actual.get(0).getTodoItems().get(0), actual.get(1).getTodoItems().get(0));
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/ibatis/submitted/emptycollection/TodoItem.java b/src/test/java/org/apache/ibatis/submitted/emptycollection/TodoItem.java
new file mode 100644
index 000000000..71a30351a
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/emptycollection/TodoItem.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.emptycollection;
+
+public class TodoItem {
+
+ @Override
+ public String toString() {
+ return "TodoItem [order=" + order + ", description=" + description + "]";
+ }
+
+ private int order;
+ private String description;
+
+ public int getOrder() {
+ return order;
+ }
+
+ public void setOrder(int order) {
+ this.order = order;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+}
diff --git a/src/test/java/org/apache/ibatis/submitted/emptycollection/TodoLists.java b/src/test/java/org/apache/ibatis/submitted/emptycollection/TodoLists.java
new file mode 100644
index 000000000..b2e0b1b4c
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/emptycollection/TodoLists.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.emptycollection;
+
+import java.util.List;
+
+public class TodoLists {
+
+ @Override
+ public String toString() {
+ return "TodoLists [id=" + id + ", todoItems=" + todoItems + "]";
+ }
+
+ private int id;
+
+ private List todoItems;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public List getTodoItems() {
+ return todoItems;
+ }
+
+ public void setTodoItems(List todoItems) {
+ this.todoItems = todoItems;
+ }
+
+}
diff --git a/src/test/java/org/apache/ibatis/submitted/emptycollection/mybatis-config.xml b/src/test/java/org/apache/ibatis/submitted/emptycollection/mybatis-config.xml
new file mode 100644
index 000000000..871a4454e
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/emptycollection/mybatis-config.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/org/apache/ibatis/submitted/foreach/ForEachTest.java b/src/test/java/org/apache/ibatis/submitted/foreach/ForEachTest.java
index 2ed0bf31e..1a8548335 100644
--- a/src/test/java/org/apache/ibatis/submitted/foreach/ForEachTest.java
+++ b/src/test/java/org/apache/ibatis/submitted/foreach/ForEachTest.java
@@ -18,8 +18,10 @@
import java.io.Reader;
import java.sql.Connection;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
+import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.jdbc.ScriptRunner;
import org.apache.ibatis.session.SqlSession;
@@ -27,12 +29,17 @@
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Assert;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
public class ForEachTest {
private static SqlSessionFactory sqlSessionFactory;
+ @Rule
+ public ExpectedException ex = ExpectedException.none();
+
@BeforeClass
public static void setUp() throws Exception {
// create a SqlSessionFactory
@@ -124,4 +131,18 @@ public void nullItemInContext() {
}
}
+ @Test
+ public void shouldReportMissingPropertyName() {
+ ex.expect(PersistenceException.class);
+ ex.expectMessage("There is no getter for property named 'idd' in 'class org.apache.ibatis.submitted.foreach.User'");
+
+ SqlSession sqlSession = sqlSessionFactory.openSession();
+ try {
+ Mapper mapper = sqlSession.getMapper(Mapper.class);
+ mapper.typoInItemProperty(Arrays.asList(new User()));
+ } finally {
+ sqlSession.close();
+ }
+ }
+
}
diff --git a/src/test/java/org/apache/ibatis/submitted/foreach/Mapper.java b/src/test/java/org/apache/ibatis/submitted/foreach/Mapper.java
index d8a1037a4..cca0bdf30 100644
--- a/src/test/java/org/apache/ibatis/submitted/foreach/Mapper.java
+++ b/src/test/java/org/apache/ibatis/submitted/foreach/Mapper.java
@@ -27,4 +27,5 @@ public interface Mapper {
String selectWithNullItemCheck(List users);
+ int typoInItemProperty(List users);
}
diff --git a/src/test/java/org/apache/ibatis/submitted/foreach/Mapper.xml b/src/test/java/org/apache/ibatis/submitted/foreach/Mapper.xml
index 0404b85ff..63d133833 100644
--- a/src/test/java/org/apache/ibatis/submitted/foreach/Mapper.xml
+++ b/src/test/java/org/apache/ibatis/submitted/foreach/Mapper.xml
@@ -62,4 +62,11 @@
+
+ insert into users (id, name) values
+
+ (#{item.idd}, #{item.name})
+
+
+
diff --git a/src/test/java/org/apache/ibatis/submitted/keygen/Country.java b/src/test/java/org/apache/ibatis/submitted/keygen/Country.java
new file mode 100644
index 000000000..dbcc73cdc
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/keygen/Country.java
@@ -0,0 +1,63 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.keygen;
+
+/**
+ * @author liuzh
+ */
+public class Country {
+ private Integer id;
+ private String countryname;
+ private String countrycode;
+
+ public Country() {
+ }
+
+ public Country(String countryname, String countrycode) {
+ this.countryname = countryname;
+ this.countrycode = countrycode;
+ }
+
+ public Country(Integer id, String countryname, String countrycode) {
+ this.id = id;
+ this.countryname = countryname;
+ this.countrycode = countrycode;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getCountryname() {
+ return countryname;
+ }
+
+ public void setCountryname(String countryname) {
+ this.countryname = countryname;
+ }
+
+ public String getCountrycode() {
+ return countrycode;
+ }
+
+ public void setCountrycode(String countrycode) {
+ this.countrycode = countrycode;
+ }
+}
diff --git a/src/test/java/org/apache/ibatis/submitted/keygen/CountryMapper.java b/src/test/java/org/apache/ibatis/submitted/keygen/CountryMapper.java
new file mode 100644
index 000000000..325ffd6d8
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/keygen/CountryMapper.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.keygen;
+
+import java.util.List;
+
+public interface CountryMapper {
+
+ int insertList(List countries);
+
+}
diff --git a/src/test/java/org/apache/ibatis/submitted/keygen/CountryMapper.xml b/src/test/java/org/apache/ibatis/submitted/keygen/CountryMapper.xml
new file mode 100644
index 000000000..e201dce49
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/keygen/CountryMapper.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+ insert into country (countryname,countrycode)
+ values
+
+ (#{country.countryname},#{country.countrycode})
+
+
+
diff --git a/src/test/java/org/apache/ibatis/submitted/keygen/CreateDB.sql b/src/test/java/org/apache/ibatis/submitted/keygen/CreateDB.sql
new file mode 100644
index 000000000..55a4dd6b4
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/keygen/CreateDB.sql
@@ -0,0 +1,23 @@
+--
+-- Copyright 2009-2016 the original author or authors.
+--
+-- 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.
+--
+
+DROP TABLE country IF EXISTS;
+
+CREATE TABLE country (
+ Id int IDENTITY,
+ countryname varchar(255) DEFAULT NULL,
+ countrycode varchar(255) DEFAULT NULL,
+);
diff --git a/src/test/java/org/apache/ibatis/submitted/keygen/Jdbc3KeyGeneratorTest.java b/src/test/java/org/apache/ibatis/submitted/keygen/Jdbc3KeyGeneratorTest.java
new file mode 100644
index 000000000..2f3fbd326
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/keygen/Jdbc3KeyGeneratorTest.java
@@ -0,0 +1,76 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.keygen;
+
+import static org.junit.Assert.*;
+
+import java.io.Reader;
+import java.sql.Connection;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ibatis.io.Resources;
+import org.apache.ibatis.jdbc.ScriptRunner;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.apache.ibatis.session.SqlSessionFactoryBuilder;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author liuzh
+ */
+public class Jdbc3KeyGeneratorTest {
+
+ private static SqlSessionFactory sqlSessionFactory;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ // create an SqlSessionFactory
+ Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/keygen/MapperConfig.xml");
+ sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
+ reader.close();
+
+ // populate in-memory database
+ SqlSession session = sqlSessionFactory.openSession();
+ Connection conn = session.getConnection();
+ reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/keygen/CreateDB.sql");
+ ScriptRunner runner = new ScriptRunner(conn);
+ runner.setLogWriter(null);
+ runner.runScript(reader);
+ reader.close();
+ session.close();
+ }
+
+ @Test
+ public void shouldInsertListAndRetrieveId() throws Exception {
+ SqlSession sqlSession = sqlSessionFactory.openSession();
+ try {
+ CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
+ List countries = new ArrayList();
+ countries.add(new Country("China", "CN"));
+ countries.add(new Country("United Kiongdom", "GB"));
+ countries.add(new Country("United States of America", "US"));
+ mapper.insertList(countries);
+ for (Country country : countries) {
+ assertNotNull(country.getId());
+ }
+ } finally {
+ sqlSession.rollback();
+ sqlSession.close();
+ }
+ }
+}
diff --git a/src/test/java/org/apache/ibatis/submitted/keygen/MapperConfig.xml b/src/test/java/org/apache/ibatis/submitted/keygen/MapperConfig.xml
new file mode 100644
index 000000000..2425f5801
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/keygen/MapperConfig.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Item.java b/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Item.java
index 70ca2e558..6a3b1d11e 100644
--- a/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Item.java
+++ b/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Item.java
@@ -19,6 +19,16 @@ public class Item {
private Integer id;
private String name;
+ public String toString(){
+ return new StringBuilder()
+ .append("Item(")
+ .append(id)
+ .append(", ")
+ .append(name)
+ .append(" )")
+ .toString();
+ }
+
public Integer getId() {
return id;
}
diff --git a/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Mapper.java b/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Mapper.java
index b786e03ff..fab97238f 100644
--- a/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Mapper.java
+++ b/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Mapper.java
@@ -20,4 +20,5 @@
public interface Mapper {
List getPersons();
List getPersonsWithItemsOrdered();
+ List getPersonItemPairs();
}
diff --git a/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Mapper.xml b/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Mapper.xml
index 380179c44..b5eb012ee 100644
--- a/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Mapper.xml
+++ b/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Mapper.xml
@@ -40,4 +40,23 @@
where p.id = i.owner
order by i.name
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/NestedResultHandlerTest.java b/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/NestedResultHandlerTest.java
index c93e9eca0..0dbef4780 100644
--- a/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/NestedResultHandlerTest.java
+++ b/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/NestedResultHandlerTest.java
@@ -150,4 +150,24 @@ public void testGetPersonOrderedByItem() {
}
}
+ @Test //reopen issue 39? (not a bug?)
+ public void testGetPersonItemPairs(){
+ SqlSession sqlSession = sqlSessionFactory.openSession();
+ try{
+ Mapper mapper = sqlSession.getMapper(Mapper.class);
+ List pairs = mapper.getPersonItemPairs();
+
+ Assert.assertNotNull( pairs );
+// System.out.println( new StringBuilder().append("selected pairs: ").append(pairs) );
+
+ Assert.assertEquals(5, pairs.size() );
+ Assert.assertNotNull(pairs.get(0).getPerson());
+ Assert.assertEquals(pairs.get(0).getPerson().getId(), Integer.valueOf(1));
+ Assert.assertNotNull(pairs.get(0).getItem());
+ Assert.assertEquals( pairs.get(0).getItem().getId(), Integer.valueOf(1));
+ } finally{
+ sqlSession.close();
+ }
+ }
+
}
diff --git a/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Person.java b/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Person.java
index d76b66cf3..8e5ad3f61 100644
--- a/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Person.java
+++ b/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/Person.java
@@ -22,7 +22,19 @@
public class Person {
private Integer id;
private String name;
- private List items=new ArrayList();
+ private List items=new ArrayList();
+
+ public String toString(){
+ return new StringBuilder()
+ .append("Person(")
+ .append(id)
+ .append(", ")
+ .append(name)
+ .append(", ")
+ .append(items)
+ .append(" )")
+ .toString();
+ }
public Integer getId() {
return id;
diff --git a/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/PersonItemPair.java b/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/PersonItemPair.java
new file mode 100644
index 000000000..60f53a195
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/nestedresulthandler/PersonItemPair.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.nestedresulthandler;
+
+/**
+ * Created by eyal on 12/9/2015.
+ */
+public class PersonItemPair {
+ private Person person;
+ private Item item;
+
+ public String toString(){
+ return new StringBuilder()
+ .append("PersonItemPair(")
+ .append(person)
+ .append(", ")
+ .append(item)
+ .append(" )")
+ .toString();
+ }
+
+ public Person getPerson() {
+ return person;
+ }
+
+ public void setPerson(Person person) {
+ this.person = person;
+ }
+
+ public Item getItem() {
+ return item;
+ }
+
+ public void setItem(Item item) {
+ this.item = item;
+ }
+}
diff --git a/src/test/java/org/apache/ibatis/submitted/results_id/AnotherMapper.java b/src/test/java/org/apache/ibatis/submitted/results_id/AnotherMapper.java
new file mode 100644
index 000000000..bde4b6223
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/results_id/AnotherMapper.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.results_id;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.ResultMap;
+import org.apache.ibatis.annotations.Select;
+
+public interface AnotherMapper {
+
+ @ResultMap("org.apache.ibatis.submitted.results_id.Mapper.userResult")
+ @Select("select * from users order by uid")
+ List getUsers();
+
+ User getUser(Integer id);
+
+}
diff --git a/src/test/java/org/apache/ibatis/submitted/results_id/AnotherMapper.xml b/src/test/java/org/apache/ibatis/submitted/results_id/AnotherMapper.xml
new file mode 100644
index 000000000..84e23a364
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/results_id/AnotherMapper.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
diff --git a/src/test/java/org/apache/ibatis/submitted/results_id/CreateDB.sql b/src/test/java/org/apache/ibatis/submitted/results_id/CreateDB.sql
new file mode 100644
index 000000000..468b8a759
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/results_id/CreateDB.sql
@@ -0,0 +1,25 @@
+--
+-- Copyright 2009-2015 the original author or authors.
+--
+-- 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.
+--
+
+drop table users if exists;
+
+create table users (
+ uid int,
+ name varchar(20)
+);
+
+insert into users (uid, name) values(1, 'User1');
+insert into users (uid, name) values(2, 'User2');
diff --git a/src/test/java/org/apache/ibatis/submitted/results_id/IdConflictMapper.java b/src/test/java/org/apache/ibatis/submitted/results_id/IdConflictMapper.java
new file mode 100644
index 000000000..3ebb57965
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/results_id/IdConflictMapper.java
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.results_id;
+
+import org.apache.ibatis.annotations.Result;
+import org.apache.ibatis.annotations.Results;
+import org.apache.ibatis.annotations.Select;
+
+public interface IdConflictMapper {
+
+ @Results(id = "userResult", value = { @Result(id = true, column = "uid", property = "id") })
+ @Select("select * from users where uid = #{id}")
+ User getUserById(Integer id);
+}
diff --git a/src/test/java/org/apache/ibatis/submitted/results_id/IdConflictMapper.xml b/src/test/java/org/apache/ibatis/submitted/results_id/IdConflictMapper.xml
new file mode 100644
index 000000000..8d312121b
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/results_id/IdConflictMapper.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/test/java/org/apache/ibatis/submitted/results_id/IdConflictTest.java b/src/test/java/org/apache/ibatis/submitted/results_id/IdConflictTest.java
new file mode 100644
index 000000000..a1a7f03fd
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/results_id/IdConflictTest.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.results_id;
+
+import org.apache.ibatis.session.Configuration;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+public class IdConflictTest {
+
+ @Rule
+ public ExpectedException ex = ExpectedException.none();
+
+ @Test
+ public void shouldFailOnDuplicatedId() throws Exception {
+ ex.expect(RuntimeException.class);
+ ex.expectMessage("Result Maps collection already contains value for org.apache.ibatis.submitted.results_id.IdConflictMapper.userResult");
+
+ Configuration configuration = new Configuration();
+ configuration.addMapper(IdConflictMapper.class);
+ configuration.getMappedStatements();
+ }
+
+}
diff --git a/src/test/java/org/apache/ibatis/submitted/results_id/Mapper.java b/src/test/java/org/apache/ibatis/submitted/results_id/Mapper.java
new file mode 100644
index 000000000..1c593344e
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/results_id/Mapper.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.results_id;
+
+import org.apache.ibatis.annotations.Arg;
+import org.apache.ibatis.annotations.ConstructorArgs;
+import org.apache.ibatis.annotations.Result;
+import org.apache.ibatis.annotations.ResultMap;
+import org.apache.ibatis.annotations.Results;
+import org.apache.ibatis.annotations.Select;
+
+public interface Mapper {
+
+ @Results(id = "userResult", value = {
+ @Result(id = true, column = "uid", property = "id"),
+ @Result(column = "name", property = "name")
+ })
+ @Select("select * from users where uid = #{id}")
+ User getUserById(Integer id);
+
+ @ResultMap("userResult")
+ @Select("select * from users where name = #{name}")
+ User getUserByName(String name);
+
+ @Results(id = "userResultConstructor")
+ @ConstructorArgs({
+ @Arg(id = true, column = "uid", javaType = Integer.class),
+ @Arg(column = "name", javaType = String.class)
+ })
+ @Select("select * from users where uid = #{id}")
+ User getUserByIdConstructor(Integer id);
+
+ @ResultMap("userResultConstructor")
+ @Select("select * from users where name = #{name}")
+ User getUserByNameConstructor(String name);
+}
diff --git a/src/test/java/org/apache/ibatis/submitted/results_id/ResultsIdTest.java b/src/test/java/org/apache/ibatis/submitted/results_id/ResultsIdTest.java
new file mode 100644
index 000000000..99621ea1f
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/results_id/ResultsIdTest.java
@@ -0,0 +1,108 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.results_id;
+
+import static org.junit.Assert.*;
+
+import java.io.Reader;
+import java.sql.Connection;
+import java.util.List;
+
+import org.apache.ibatis.io.Resources;
+import org.apache.ibatis.jdbc.ScriptRunner;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.apache.ibatis.session.SqlSessionFactoryBuilder;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ResultsIdTest {
+
+ private static SqlSessionFactory sqlSessionFactory;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ // create an SqlSessionFactory
+ Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/results_id/mybatis-config.xml");
+ sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
+ reader.close();
+
+ // populate in-memory database
+ SqlSession session = sqlSessionFactory.openSession();
+ Connection conn = session.getConnection();
+ reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/results_id/CreateDB.sql");
+ ScriptRunner runner = new ScriptRunner(conn);
+ runner.setLogWriter(null);
+ runner.runScript(reader);
+ reader.close();
+ session.close();
+ }
+
+ @Test
+ public void testNamingResults() {
+ SqlSession sqlSession = sqlSessionFactory.openSession();
+ try {
+ Mapper mapper = sqlSession.getMapper(Mapper.class);
+ User user = mapper.getUserByName("User2");
+ assertEquals(Integer.valueOf(2), user.getId());
+ assertEquals("User2", user.getName());
+ } finally {
+ sqlSession.close();
+ }
+ }
+
+ @Test
+ public void testResultsOnlyForNaming() {
+ SqlSession sqlSession = sqlSessionFactory.openSession();
+ try {
+ Mapper mapper = sqlSession.getMapper(Mapper.class);
+ User user = mapper.getUserByNameConstructor("User2");
+ assertEquals(Integer.valueOf(2), user.getId());
+ assertEquals("User2", user.getName());
+ } finally {
+ sqlSession.close();
+ }
+ }
+
+ @Test
+ public void testReuseNamedResultsFromAnotherMapper() {
+ SqlSession sqlSession = sqlSessionFactory.openSession();
+ try {
+ AnotherMapper mapper = sqlSession.getMapper(AnotherMapper.class);
+ List users = mapper.getUsers();
+ assertEquals(2, users.size());
+ assertEquals(Integer.valueOf(1), users.get(0).getId());
+ assertEquals("User1", users.get(0).getName());
+ assertEquals(Integer.valueOf(2), users.get(1).getId());
+ assertEquals("User2", users.get(1).getName());
+ } finally {
+ sqlSession.close();
+ }
+ }
+
+ @Test
+ public void testReuseNamedResultsFromXmlMapper() {
+ SqlSession sqlSession = sqlSessionFactory.openSession();
+ try {
+ AnotherMapper mapper = sqlSession.getMapper(AnotherMapper.class);
+ User user = mapper.getUser(1);
+ assertEquals(Integer.valueOf(1), user.getId());
+ assertEquals("User1", user.getName());
+ } finally {
+ sqlSession.close();
+ }
+ }
+}
diff --git a/src/test/java/org/apache/ibatis/submitted/results_id/User.java b/src/test/java/org/apache/ibatis/submitted/results_id/User.java
new file mode 100644
index 000000000..0fbbaa3e8
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/results_id/User.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2009-2015 the original author or authors.
+ *
+ * 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.submitted.results_id;
+
+public class User {
+
+ private Integer id;
+ private String name;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public User() {
+ super();
+ }
+
+ public User(Integer id, String name) {
+ super();
+ this.id = id;
+ this.name = name;
+ }
+}
diff --git a/src/test/java/org/apache/ibatis/submitted/results_id/mybatis-config.xml b/src/test/java/org/apache/ibatis/submitted/results_id/mybatis-config.xml
new file mode 100644
index 000000000..db4946de3
--- /dev/null
+++ b/src/test/java/org/apache/ibatis/submitted/results_id/mybatis-config.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+