应用场景:
我有一张订单表,一张代理商表,我订单表和代理商设置为many-to-one。
public class ProxyCustomer {
private int id;
}
public class Order {
private int id;
private ProxyCustomer proxyCustomer;
}
many-to-one 配置如下:
<many-to-one name="proxyCustomer" column="proxy_customer_id" class="com.pro.entity.ProxyCustomer" not-null="false" fetch="join" lazy="false"/>
执行查询后,为什么list中会返回两个对象,一个是Order对象,一个是ProxyCustomer对象
而我期望只要一个Order对象,因为Order对象里包含了ProxyCustomer对象。
debug 看到的现象如下截图: