org.apache.ibatis.mapping.FetchType Java Examples

The following examples show how to use org.apache.ibatis.mapping.FetchType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserMapper.java    From code with Apache License 2.0 6 votes vote down vote up
/**
 * 查询所有用户
 * @return
 */
@Select("select * from user")
//@Results(id = "userMap",
//        value = {
//                @Result(id = true, column = "id", property = "userId"),
//                @Result(column = "username", property = "userName"),
//                @Result(column = "sex", property = "userSex"),
//                @Result(column = "address", property = "userAddress"),
//                @Result(column = "birthday", property = "userBirthday")
//        })
@Results(id="userMap",
        value= {
                @Result(id=true,column="id",property="userId"),
                @Result(column="username",property="userName"),
                @Result(column="sex",property="userSex"),
                @Result(column="address",property="userAddress"),
                @Result(column="birthday",property="userBirthday"),
                @Result(column="id",property="accounts",
                        many=@Many(
                                select="cn.lastwhisper.mybatis.annotation.manytable.dao.AccountMapper.findByUid",
                                fetchType= FetchType.LAZY
                        )
                )
        })
List<User> findAll();
 
Example #2
Source File: RDBAnalyzeMapper.java    From RCT with Apache License 2.0 5 votes vote down vote up
@Select("select * from rdb_analyze")
@Results({ @Result(id = true, column = "id", property = "id"),
		@Result(column = "auto_analyze", property = "autoAnalyze"),
		@Result(column = "schedule", property = "schedule"), @Result(column = "dataPath", property = "dataPath"),
		@Result(column = "prefixes", property = "prefixes"), @Result(column = "is_report", property = "report"),
		@Result(column = "mailTo", property = "mailTo"), @Result(column = "analyzer", property = "analyzer"),
		@Result(column = "pid", property = "redisInfo", one = @One(select = "org.nesc.ecbd.mapper.RedisInfoMapper.queryById", fetchType = FetchType.EAGER)) })
List<RDBAnalyze> queryList();
 
Example #3
Source File: RDBAnalyzeMapper.java    From RCT with Apache License 2.0 5 votes vote down vote up
@Select("select * from rdb_analyze where pid = #{pid}")
@Results({ @Result(id = true, column = "id", property = "id"),
		@Result(column = "auto_analyze", property = "autoAnalyze"),
		@Result(column = "schedule", property = "schedule"), @Result(column = "dataPath", property = "dataPath"),
		@Result(column = "prefixes", property = "prefixes"), @Result(column = "is_report", property = "report"),
		@Result(column = "mailTo", property = "mailTo"), @Result(column = "analyzer", property = "analyzer"),
		@Result(column = "pid", property = "redisInfo", one = @One(select = "org.nesc.ecbd.mapper.RedisInfoMapper.queryById", fetchType = FetchType.EAGER)) })
RDBAnalyze getRDBAnalyzeByPid(Long pid);
 
Example #4
Source File: AccountMapper.java    From code with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @return
 */
@Select("select * from account")
@Results(id="accountMap",
        value= {
                @Result(id=true,column="id",property="id"),
                @Result(column="uid",property="uid"),
                @Result(column="money",property="money"),
                @Result(column="uid",
                        property="user",
                        one=@One(select="cn.lastwhisper.mybatis.annotation.manytable.dao.UserMapper.findById",
                                fetchType= FetchType.LAZY)
                )
        })
List<Account> findAll();
 
Example #5
Source File: BoundBlogMapper.java    From mybaties with Apache License 2.0 5 votes vote down vote up
@Select({
    "SELECT *",
    "FROM blog"
})
@Results({ 
    @Result(property = "author", column = "author_id", one = @One(select = "org.apache.ibatis.binding.BoundAuthorMapper.selectAuthor", fetchType=FetchType.EAGER)), 
    @Result(property = "posts", column = "id", many = @Many(select = "selectPostsById", fetchType=FetchType.EAGER))
})
List<Blog> selectBlogsWithAutorAndPostsEagerly();
 
Example #6
Source File: BoundBlogMapper.java    From mybatis with Apache License 2.0 5 votes vote down vote up
@Select({
    "SELECT *",
    "FROM blog"
})
@Results({ 
    @Result(property = "author", column = "author_id", one = @One(select = "org.apache.ibatis.binding.BoundAuthorMapper.selectAuthor", fetchType=FetchType.EAGER)), 
    @Result(property = "posts", column = "id", many = @Many(select = "selectPostsById", fetchType=FetchType.EAGER))
})
List<Blog> selectBlogsWithAutorAndPostsEagerly();