对于一对多的resultMap的定义
调用resultMap
mapper中的接口
public List findOrderAndOrderDetailResultMap() throws Exception;
Test
public class OrdersMapperCustomTest {
private SqlSessionFactory sqlSessionFactory;
@Before
public void setUp() throws Exception {
InputStream inputStream = Resources.getResourceAsStream("SqlMapConfig.xml");
sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
}
@Test
public void testFindOrderAndOrderDetailResultMap() throws Exception {
SqlSession sqlSession = sqlSessionFactory.openSession();
OrdersMapperCustom ordersMapperCustom = sqlSession.getMapper(OrdersMapperCustom.class);
List orderList = ordersMapperCustom.findOrderAndOrderDetailResultMap();
System.out.println(orderList);
}
}