日期:2014-05-18  浏览次数:20831 次

hibernate外键取值问题
XML code

<class name="com.actransfer.hibernate.po.AcWebDiscount" table="AC_WebDiscount" schema="dbo">
        <id name="discountId" type="java.lang.String">
            <column name="Discount_Id" length="50" />
        </id>
        <many-to-one name="acStockPile" class="com.actransfer.hibernate.po.AcStockPile" fetch="select">
            <column name="Product_Id" length="50" />
        </many-to-one>
        <property name="packageId" type="java.lang.String">
            <column name="Package_Id" length="50" />
        </property>
        <property name="webFlag" type="java.lang.String">
            <column name="Web_Flag" length="50" />
        </property>
        <property name="salePrice" type="java.lang.Float">
            <column name="Sale_Price" precision="53" scale="0" />
        </property>
        <property name="stockProductSort" type="java.lang.Integer">
            <column name="StockProduct_Sort" />
        </property>
        <property name="discountRate" type="java.lang.Float">
            <column name="Discount_Rate" precision="53" scale="0" />
        </property>
        <property name="discountPrice" type="java.lang.Float">
            <column name="Discount_Price" precision="53" scale="0" />
        </property>
        <property name="discountUpdate" type="java.lang.Integer">
            <column name="Discount_Update" />
        </property>
    </class>



表上有一个外键字段 Product_Id 怎么根据Product_Id查询出数据 请指教

------解决方案--------------------
没看明白,你要查那个表啊?要是查这个表不是太难吧。还有你要全查、还是要查一个啊?