diff --git a/src/test/java/org/apache/ibatis/submitted/automapping/AutomappingTest.java b/src/test/java/org/apache/ibatis/submitted/automapping/AutomappingTest.java
index 89fa5d9a653..43b33f65b33 100644
--- a/src/test/java/org/apache/ibatis/submitted/automapping/AutomappingTest.java
+++ b/src/test/java/org/apache/ibatis/submitted/automapping/AutomappingTest.java
@@ -19,6 +19,7 @@
import java.sql.Connection;
import java.util.List;
+import org.apache.commons.lang3.ObjectUtils;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.jdbc.ScriptRunner;
import org.apache.ibatis.session.AutoMappingBehavior;
@@ -65,6 +66,36 @@ public void shouldGetAUser() {
}
}
+ @Test
+ public void shouldGetAUserWithoutAsAliases() {
+ sqlSessionFactory.getConfiguration().setAutoMappingBehavior(AutoMappingBehavior.NONE);
+ SqlSession sqlSession = sqlSessionFactory.openSession();
+ try {
+ Mapper mapper = sqlSession.getMapper(Mapper.class);
+ User user = mapper.getUserPhoneNumberWithoutAs(1);
+ Assert.assertEquals("User1", user.getName());
+ Assert.assertNotNull(user.getPhone());
+ Assert.assertTrue("Phone number is not equals to 12345678901", ObjectUtils.equals(12345678901L, user.getPhone()));
+ } finally {
+ sqlSession.close();
+ }
+ }
+
+ @Test
+ public void shouldGetAUserWithAsAliases() {
+ sqlSessionFactory.getConfiguration().setAutoMappingBehavior(AutoMappingBehavior.NONE);
+ SqlSession sqlSession = sqlSessionFactory.openSession();
+ try {
+ Mapper mapper = sqlSession.getMapper(Mapper.class);
+ User user = mapper.getUserPhoneNumberWithAs(1);
+ Assert.assertEquals("User1", user.getName());
+ Assert.assertNotNull(user.getPhone());
+ Assert.assertTrue("Phone number is not equals to 12345678901", ObjectUtils.equals(12345678901L, user.getPhone()));
+ } finally {
+ sqlSession.close();
+ }
+ }
+
@Test
public void shouldGetAUserWhithPhoneNumber() {
sqlSessionFactory.getConfiguration().setAutoMappingBehavior(AutoMappingBehavior.NONE);
diff --git a/src/test/java/org/apache/ibatis/submitted/automapping/Mapper.java b/src/test/java/org/apache/ibatis/submitted/automapping/Mapper.java
index 4e71de9aada..cf40dfcb9d1 100644
--- a/src/test/java/org/apache/ibatis/submitted/automapping/Mapper.java
+++ b/src/test/java/org/apache/ibatis/submitted/automapping/Mapper.java
@@ -21,6 +21,10 @@ public interface Mapper {
User getUser(Integer id);
+ User getUserPhoneNumberWithoutAs(Integer id);
+
+ User getUserPhoneNumberWithAs(Integer id);
+
User getUserWithPhoneNumber(Integer id);
User getUserWithPets_Inline(Integer id);
diff --git a/src/test/java/org/apache/ibatis/submitted/automapping/Mapper.xml b/src/test/java/org/apache/ibatis/submitted/automapping/Mapper.xml
index 1fc80c889c3..1252127216e 100644
--- a/src/test/java/org/apache/ibatis/submitted/automapping/Mapper.xml
+++ b/src/test/java/org/apache/ibatis/submitted/automapping/Mapper.xml
@@ -29,6 +29,20 @@
+
+
+
+
+
+
+
+
+
+