久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    1. <tfoot id='szP8t'></tfoot>

      <small id='szP8t'></small><noframes id='szP8t'>

    2. <legend id='szP8t'><style id='szP8t'><dir id='szP8t'><q id='szP8t'></q></dir></style></legend>
          <bdo id='szP8t'></bdo><ul id='szP8t'></ul>
        <i id='szP8t'><tr id='szP8t'><dt id='szP8t'><q id='szP8t'><span id='szP8t'><b id='szP8t'><form id='szP8t'><ins id='szP8t'></ins><ul id='szP8t'></ul><sub id='szP8t'></sub></form><legend id='szP8t'></legend><bdo id='szP8t'><pre id='szP8t'><center id='szP8t'></center></pre></bdo></b><th id='szP8t'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='szP8t'><tfoot id='szP8t'></tfoot><dl id='szP8t'><fieldset id='szP8t'></fieldset></dl></div>

        如何使用 Hibernate @Any 相關的注解?

        How to use Hibernate @Any-related annotations?(如何使用 Hibernate @Any 相關的注解?)
              1. <legend id='W0shs'><style id='W0shs'><dir id='W0shs'><q id='W0shs'></q></dir></style></legend>
                  <bdo id='W0shs'></bdo><ul id='W0shs'></ul>

                • <i id='W0shs'><tr id='W0shs'><dt id='W0shs'><q id='W0shs'><span id='W0shs'><b id='W0shs'><form id='W0shs'><ins id='W0shs'></ins><ul id='W0shs'></ul><sub id='W0shs'></sub></form><legend id='W0shs'></legend><bdo id='W0shs'><pre id='W0shs'><center id='W0shs'></center></pre></bdo></b><th id='W0shs'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='W0shs'><tfoot id='W0shs'></tfoot><dl id='W0shs'><fieldset id='W0shs'></fieldset></dl></div>
                    <tbody id='W0shs'></tbody>
                • <tfoot id='W0shs'></tfoot>

                  <small id='W0shs'></small><noframes id='W0shs'>

                  本文介紹了如何使用 Hibernate @Any 相關的注解?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  有人可以向我解釋一下 Any 相關的注釋(@Any@AnyMetaDef、@AnyMetaDefs@ManyToAny) 在實踐中工作.我很難找到任何關于這些的有用文檔(僅 JavaDoc 不是很有幫助).

                  Could someone explain to me how Any-related annotations (@Any, @AnyMetaDef, @AnyMetaDefs and @ManyToAny) work in practice. I have a hard time finding any useful documentation (JavaDoc alone isn't very helpful) about these.

                  到目前為止,我已經收集到它們以某種方式啟用對抽象類和擴展類的引用.如果是這種情況,為什么沒有 @OneToAny 注釋?這個any"是指一個any"還是多個any"?

                  I have thus far gathered that they somehow enable referencing to abstract and extended classes. If this is the case, why is there not an @OneToAny annotation? And is this 'any' referring to a single 'any', or multiple 'any'?

                  非常感謝一個簡短、實用且說明性的示例(不必編譯).

                  A short, practical and illustrating example would be very much appreciated (doesn't have to compile).

                  盡管我愿意接受作為答案的回復并在適當的時候給予信任,但我發現 Smink 和 Sakana 的答案都提供了豐富的信息.因為我不能接受多個回復作為答案,所以很遺憾,我將兩者都標記為答案.

                  as much as I would like to accept replies as answers and give credit where due, I found both Smink's and Sakana's answers informative. Because I can't accept several replies as the answer, I will unfortunately mark neither as the answer.

                  推薦答案

                  希望這篇文章 為主題帶來一些亮點:

                  Hope this article brings some light to the subject:

                  有時我們需要映射一個關聯屬性不同沒有屬性的實體類型共同祖先實體 - 如此簡單多態關聯不起作用工作.

                  Sometimes we need to map an association property to different types of entities that don't have a common ancestor entity - so a plain polymorphic association doesn't do the work.

                  例如,讓我們假設管理媒體庫的三個不同應用程序 - 第一個應用程序管理圖書借閱,第二個應用程序管理 DVD,第三個應用程序管理 VHS.這些應用程序沒有任何共同點.現在我們要開發一個新的應用程序來管理所有三種媒體類型并重用現有的 Book、DVD 和 VHS 實體.由于 Book、DVD 和 VHS 類來自不同的應用程序,它們沒有任何祖先實體——共同的祖先是 java.lang.Object.我們仍然希望有一個 Borrow 實體,它可以引用任何可能的媒體類型.

                  For example let's assume three different applications which manage a media library - the first application manages books borrowing, the second one DVDs, and the third VHSs. The applications have nothing in common. Now we want to develop a new application that manages all three media types and reuses the exiting Book, DVD, and VHS entities. Since Book, DVD, and VHS classes came from different applications they don't have any ancestor entity - the common ancestor is java.lang.Object. Still we would like to have one Borrow entity which can refer to any of the possible media type.

                  為了解決這種類型的引用,我們可以使用 any 映射.此映射始終包含多個列:一列包含當前映射屬性所引用的實體的類型,另一列包含實體的標識,例如,如果我們引用一本書,它的第一列將包含一個標記Book 實體類型,第二個將包含特定書籍的 id.

                  To solve this type of references we can use the any mapping. this mapping always includes more than one column: one column includes the type of the entity the current mapped property refers to and the other includes the identity of the entity, for example if we refer to a book it the first column will include a marker for the Book entity type and the second one will include the id of the specific book.

                  @Entity
                  @Table(name = "BORROW")
                  public class Borrow{
                  
                      @Id
                      @GeneratedValue
                      private Long id;
                  
                      @Any(metaColumn = @Column(name = "ITEM_TYPE"))
                      @AnyMetaDef(idType = "long", metaType = "string", 
                              metaValues = { 
                               @MetaValue(targetEntity = Book.class, value = "B"),
                               @MetaValue(targetEntity = VHS.class, value = "V"),
                               @MetaValue(targetEntity = DVD.class, value = "D")
                         })
                      @JoinColumn(name="ITEM_ID")
                      private Object item;
                  
                       .......
                      public Object getItem() {
                          return item;
                      }
                  
                      public void setItem(Object item) {
                          this.item = item;
                      }
                  
                  }
                  

                  這篇關于如何使用 Hibernate @Any 相關的注解?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯誤)
                  Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 語句 - 是“或/“和可能的?)
                  Java Replace Character At Specific Position Of String?(Java替換字符串特定位置的字符?)
                  What is the type of a ternary expression with int and char operands?(具有 int 和 char 操作數的三元表達式的類型是什么?)
                  Read a text file and store every single character occurrence(讀取文本文件并存儲出現的每個字符)
                  Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉換 char 原語?)
                  <tfoot id='3ZX3s'></tfoot>
                    <bdo id='3ZX3s'></bdo><ul id='3ZX3s'></ul>

                          <tbody id='3ZX3s'></tbody>
                        <i id='3ZX3s'><tr id='3ZX3s'><dt id='3ZX3s'><q id='3ZX3s'><span id='3ZX3s'><b id='3ZX3s'><form id='3ZX3s'><ins id='3ZX3s'></ins><ul id='3ZX3s'></ul><sub id='3ZX3s'></sub></form><legend id='3ZX3s'></legend><bdo id='3ZX3s'><pre id='3ZX3s'><center id='3ZX3s'></center></pre></bdo></b><th id='3ZX3s'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='3ZX3s'><tfoot id='3ZX3s'></tfoot><dl id='3ZX3s'><fieldset id='3ZX3s'></fieldset></dl></div>

                          <small id='3ZX3s'></small><noframes id='3ZX3s'>

                            <legend id='3ZX3s'><style id='3ZX3s'><dir id='3ZX3s'><q id='3ZX3s'></q></dir></style></legend>
                            主站蜘蛛池模板: 国产剧情一区 | 久久91视频 | 午夜欧美一区二区三区在线播放 | 欧美久久国产 | 成人精品在线观看 | 色婷婷影院 | 中文字幕不卡在线观看 | 91精品久久久久久久久中文字幕 | 免费看av大片 | 天堂色 | 久久三区| 小川阿佐美pgd-606在线 | 欧美一级二级三级视频 | 男人天堂99 | 日韩字幕 | 1区2区3区视频 | 欧美爱爱视频网站 | 国产精品免费在线 | 亚洲h在线观看 | 99热99| xx视频在线观看 | 国产97在线视频 | av一区二区三区 | 久久精品国产一区二区电影 | 久久久久久久久久久久91 | 国产视频一视频二 | 日韩和的一区二区 | 久久久久国产精品一区 | 国产91在线 | 亚洲 | 亚洲网址在线观看 | 三级黄色片在线观看 | 日韩精品成人一区二区三区视频 | 精品免费国产一区二区三区 | 精品无码久久久久国产 | 日本一二三区在线观看 | 免费精品一区 | 日韩中文字幕2019 | 香蕉视频91 | 剑来高清在线观看 | 亚洲综合色站 | 免费国产精品久久久久久 |