It notes the development of TZ_03_mybatis

1. The development of many comments

 1> query demand by all users, and find all accounts (using lazy loading mode) of the user

  @Select("select * from user")  //sql语句查询
    //其他结果集可以调用 @ResultMap(value={"useMap"})  只有一个时直接@ResultMap("useMap")
    @Results(id="userMap", value={       
            @Result(id=true,property="id", column="id" ),
            @Result(property="username", column="username" ),
            @Result(property="sex", column="sex" ),
            @Result(property="birthday", column="birthday" ),
            @Result(property="address", column="address" ),com.hdh.dao.AccountDao.selectAccountById check account
// many developed using many = @ Many ways to annotate the query id to
       // fetchType = FetchType.LAZY loading: Lazy loading fetchType = FetchType .EAGER loaded directly
@Result (Property
= "Accounts", column = "the above mentioned id", MANY = @ Many (the SELECT = "com.hdh.dao.AccountDao. selectAccountById ", = fetchTypeto FetchType.LAZY)) }) List<the User> the findAll ();

 

Guess you like

Origin www.cnblogs.com/asndxj/p/11313327.html