<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 8.4\. 組件作為聯合標識符(Components as composite identifiers) 你可以使用一個組件作為一個實體類的標識符。 你的組件類必須滿足以下要求: * 它必須實現`java.io.Serializable`接口 * 它必須重新實現`equals()`和`hashCode()`方法, 始終和組合關鍵字在數據庫中的概念保持一致 _注意:在Hibernate3中,第二個要求并非是Hibernate強制必須的。但最好這樣做。_ 你不能使用一個`IdentifierGenerator`產生組合關鍵字。一個應用程序必須分配它自己的標識符。 使用`&lt;composite-id&gt;` 標簽(并且內嵌`&lt;key-property&gt;`元素)代替通常的`&lt;id&gt;`標簽。比如,`OrderLine`類具有一個主鍵,這個主鍵依賴于`Order`的(聯合)主鍵。 ``` <class name="OrderLine"> <composite-id name="id" class="OrderLineId"> <key-property name="lineId"/> <key-property name="orderId"/> <key-property name="customerId"/> </composite-id> <property name="name"/> <many-to-one name="order" class="Order" insert="false" update="false"> <column name="orderId"/> <column name="customerId"/> </many-to-one> .... </class> ``` 現在,任何指向`OrderLine`的外鍵都是復合的。在你的映射文件中,必須為其他類也這樣聲明。例如,一個指向`OrderLine`的關聯可能被這樣映射: ``` <many-to-one name="orderLine" class="OrderLine"> <!-- the "class" attribute is optional, as usual --> <column name="lineId"/> <column name="orderId"/> <column name="customerId"/> </many-to-one> ``` (注意在各個地方`&lt;column&gt;`標簽都是`column`屬性的替代寫法。) 指向`OrderLine`的`多對多`關聯也使用聯合外鍵: ``` <set name="undeliveredOrderLines"> <key column name="warehouseId"/> <many-to-many class="OrderLine"> <column name="lineId"/> <column name="orderId"/> <column name="customerId"/> </many-to-many> </set> ``` 在`Order`中,`OrderLine`的集合則是這樣: ``` <set name="orderLines" inverse="true"> <key> <column name="orderId"/> <column name="customerId"/> </key> <one-to-many class="OrderLine"/> </set> ``` (與通常一樣,`&lt;one-to-many&gt;`元素不聲明任何列.) 假若`OrderLine`本身擁有一個集合,它也具有組合外鍵。 ``` <class name="OrderLine"> .... .... <list name="deliveryAttempts"> <key> <!-- a collection inherits the composite key type --> <column name="lineId"/> <column name="orderId"/> <column name="customerId"/> </key> <list-index column="attemptId" base="1"/> <composite-element class="DeliveryAttempt"> ... </composite-element> </set> </class> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看