• <bdo id='QUKl2'></bdo><ul id='QUKl2'></ul>
      <tfoot id='QUKl2'></tfoot>

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

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

      2. 需要一个 Hibernate 中的主键 @OneToOne 映射示例

        时间:2023-09-28

            <tbody id='sD4BT'></tbody>
            <bdo id='sD4BT'></bdo><ul id='sD4BT'></ul>

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

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

                  <legend id='sD4BT'><style id='sD4BT'><dir id='sD4BT'><q id='sD4BT'></q></dir></style></legend>
                • 本文介绍了需要一个 Hibernate 中的主键 @OneToOne 映射示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  谁能给我一个Hibernate中单向@OneToOne主键映射的例子?我尝试了很多组合,到目前为止,我得到的最好的结果是:

                  Can somebody please give me an example of a unidirectional @OneToOne primary-key mapping in Hibernate ? I've tried numerous combinations, and so far the best thing I've gotten is this :

                  @Entity
                  @Table(name = "paper_cheque_stop_metadata")
                  @org.hibernate.annotations.Entity(mutable = false)
                  public class PaperChequeStopMetadata implements Serializable, SecurityEventAware {
                  
                  private static final long serialVersionUID = 1L;
                  
                  @Id
                  @JoinColumn(name = "paper_cheque_id")
                  @OneToOne(cascade = {}, fetch = FetchType.EAGER, optional = false, targetEntity = PaperCheque.class)
                  private PaperCheque paperCheque;
                  }
                  

                  每当 Hibernate 尝试为上述映射自动生成架构时,它都会尝试将主键创建为 blob,而不是 long,这是 PaperCheque 的 id 类型.有人能帮帮我吗 ?如果我不能得到一个确切的解决方案,可以做一些接近的事情,但我会很感激任何回应.

                  Whenever Hibernate tries to automatically generate the schema for the above mapping, it tries to create the primary key as a blob, instead of as a long, which is the id type of PaperCheque. Can somebody please help me ? If I can't get an exact solution, something close would do, but I'd appreciate any response.

                  推荐答案

                  您的意图是在 PaperChequeStopMetaData 和 PaperCheque 之间建立 1-1 的关系?如果是这样,您不能将 PaperCheque 实例定义为 PaperChequeStopMetaData 的 @Id,您必须在 PaperChequeStopMetaData 中定义一个单独的 @Id 列.

                  Your intention is to have a 1-1 relationship between PaperChequeStopMetaData and PaperCheque? If that's so, you can't define the PaperCheque instance as the @Id of PaperChequeStopMetaData, you have to define a separate @Id column in PaperChequeStopMetaData.

                  这篇关于需要一个 Hibernate 中的主键 @OneToOne 映射示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 Java 6 注解处理器中查找方法返回类型的类型参 下一篇:从@Valid 验证中排除一些字段

                  相关文章

                  最新文章

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

                  2. <i id='Sm7wZ'><tr id='Sm7wZ'><dt id='Sm7wZ'><q id='Sm7wZ'><span id='Sm7wZ'><b id='Sm7wZ'><form id='Sm7wZ'><ins id='Sm7wZ'></ins><ul id='Sm7wZ'></ul><sub id='Sm7wZ'></sub></form><legend id='Sm7wZ'></legend><bdo id='Sm7wZ'><pre id='Sm7wZ'><center id='Sm7wZ'></center></pre></bdo></b><th id='Sm7wZ'></th></span></q></dt></tr></i><div id='Sm7wZ'><tfoot id='Sm7wZ'></tfoot><dl id='Sm7wZ'><fieldset id='Sm7wZ'></fieldset></dl></div>

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

                    <legend id='Sm7wZ'><style id='Sm7wZ'><dir id='Sm7wZ'><q id='Sm7wZ'></q></dir></style></legend>
                      <bdo id='Sm7wZ'></bdo><ul id='Sm7wZ'></ul>