Management

iBatis 3.0 preview - část druhá

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN" "http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd"> <mapper namespace="domain.blog.mappers.AuthorMapper"> ... další definice ... SqlSession session = sqlMapper.openSession(); try { BlogMapper mapper = session.getMapper(BlogMapper.class); List posts = mapper.selectAllPosts(null, 0, 2); assertEquals(2, posts.size()); assertEquals(1, posts.get(0).get("ID")); assertEquals(2, posts.get(1).get("ID")); } finally { session.close(); } public interface BoundBlogMapper { @Select({"SELECT * FROM blog"}) List selectBlogs(); @Select({"SELECT * FROM blog"}) List selectBlogsAsMaps(); @Select("SELECT * FROM post ORDER BY id") @TypeDiscriminator( column = "draft", javaType = String.