我有2个表,一个shop 还有一个shopcoupon 2者一对多关联关系,shop里面有2个数据,shopcoupon有且只有一条数据对应shop表,我用left join on 语句查询数据,按理说应该返回2条数据吧?,但是只返回了1条数据,而且好像还是2个对象类型的,我打印出来时2个实体对象类型的,是怎么回事啊?
相关代码:
shop.hbm.xml
-------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.joint.joint_ddw.entity.DdwShop" table="ddw_shop" catalog="joint_ddw">
<id name="shopid" type="java.lang.Integer">
<column name="shopid" />
<generator class="native" />
</id>
<property name="shopname" type="java.lang.String">
<column name="shopname" length="40" not-null="true" />
</property>
。。。。中间省略了一些
<property name="status" type="java.lang.String">
<column name="status" length="1" not-null="true">
<comment>N-新建, A-已审核, S-暂停, D-已删除</comment>
</column>
</property>
<property name="mapaddress" type="java.lang.String">
<column name="mapaddress" length="800" />
</property>
<set name="shopcoupons" outer-join="true" cascade="none">
<key column="shopid" foreign-key="shopid"></key>
<one-to-many class="com.joint.joint_ddw.entity.DdwShopcoupon"/>
</set>
</class>
</hibernate-mapping>
-----------------------------------
shopcoupon.hbm.xml
-----------------------------------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.joint.joint_ddw.entity.DdwShopcoupon" table="ddw_shopcoupon" catalog="joint_ddw">
<id name="couponid" type="java.lang.Integer">
<column name="couponid" />
<generator class="native" />
</id>
<property name="shopid" type="java.lang.Integer">
<column name="shopid" not-null="true">
<comment>0-禮品</comment>
</column>
</property>
。。。中间省略了一些
<property name="discount" type="java.lang.String">
<column name="discount" length="3" />
</property>
</class>
</hibernate-mapping>
----------------------
shop------------实体类
-------------------------------------------
package com.joint.joint_ddw.entity;
import java.util.HashSet;
import java.util.Set;