ASP源码.NET源码PHP源码JSP源码JAVA源码DELPHI源码PB源码VC源码VB源码Android源码

mybatis mapper association collection

来源:网络整理     时间:2016-03-25     关键词:

本篇文章主要介绍了"mybatis mapper association collection",主要涉及到方面的内容,对于Javajrs看球网直播吧_低调看直播体育app软件下载_低调看体育直播感兴趣的同学可以参考一下: 1.Question Description: sometimes, POJO bean contains another bean or collectio...

1.Question Description:

  sometimes, POJO bean contains another bean or collection as property,

  it's suitable for select data from more than one table.

2. Solution:

  2.1 mybatis mapper file , for example:


 
   
   
   
   
   
    ......
 

  .....

type="cn.net.syl.model.Products" extends="BaseResultMap">
        <association property="prodExt" javaType="cn.net.syl.model.ProductsExt">
          
         
         ....
       
        <collection property="prodPropImgList" ofType="cn.net.syl.model.ProductsPreviewImages">
              
           
            ..........
       
 

 

  2.2  POJO bean , for example:

public class Products {
    
    private String idStr;
    
    private Long productId;
    private String productName;
    ............
    
    //add field for sql
    private ProductsExt prodExt;
    
    
    //add field for sql
    List prodPropImgList;
    
    //add field for sql
    private List baseProdPropList;

    //getter and setter method

    ....

}

以上就介绍了mybatis mapper association collection,包括了方面的内容,希望对Javajrs看球网直播吧_低调看直播体育app软件下载_低调看体育直播有兴趣的朋友有所帮助。

本文网址链接:http://www.codes51.com/article/detail_517171.html

相关图片

相关文章