• <bdo id='AktmX'></bdo><ul id='AktmX'></ul>
  1. <small id='AktmX'></small><noframes id='AktmX'>

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

      <tfoot id='AktmX'></tfoot>

      Org.Hibernate.AnnotationException:没有为实体指定标识符我的表中没有 id

      Org.Hibernate.AnnotationException: No Identifier Specified For Entity I don#39;t have a id in my table(Org.Hibernate.AnnotationException:没有为实体指定标识符我的表中没有 id)
        • <bdo id='9lPIi'></bdo><ul id='9lPIi'></ul>
            <legend id='9lPIi'><style id='9lPIi'><dir id='9lPIi'><q id='9lPIi'></q></dir></style></legend>
          1. <i id='9lPIi'><tr id='9lPIi'><dt id='9lPIi'><q id='9lPIi'><span id='9lPIi'><b id='9lPIi'><form id='9lPIi'><ins id='9lPIi'></ins><ul id='9lPIi'></ul><sub id='9lPIi'></sub></form><legend id='9lPIi'></legend><bdo id='9lPIi'><pre id='9lPIi'><center id='9lPIi'></center></pre></bdo></b><th id='9lPIi'></th></span></q></dt></tr></i><div id='9lPIi'><tfoot id='9lPIi'></tfoot><dl id='9lPIi'><fieldset id='9lPIi'></fieldset></dl></div>

                <tbody id='9lPIi'></tbody>

              <tfoot id='9lPIi'></tfoot>
              • <small id='9lPIi'></small><noframes id='9lPIi'>

              • 本文介绍了Org.Hibernate.AnnotationException:没有为实体指定标识符我的表中没有 id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用数据库中的一个表,并且该表没有主键或具有可以充当主键的唯一值的正确列,我无权更改该表.

                I'm working with a table in a database and that table don't have a primary key or a proper column whith a unique value who can act as a primary key, I don't have permissions to alter that table.

                我该怎么办?我尝试将@id 注释放在一个随机列中并且它有效,但我不知道这是否会在以后带来任何麻烦.我该怎么办?

                What should I do? I tried putting a @id annotation in a random column and it worked, but I don't know if this is going to bring any trouble later on. what can I do?

                我的班级

                @Entity
                @Table(name="my_table")
                public class TheTable {
                @Column (name="name", nullable=false)
                    private String name;
                
                    @Id <--- I just put this id in this random column but this column should not be a id column
                    @Column (name="anyfield", nullable=false)
                    private String anyfield;
                }
                

                推荐答案

                我遇到了这个问题并且为 @id 使用了错误的导入:

                I had this problem and was using the wrong import for @id:

                确保它是:

                import javax.persistence.Id;
                

                而不是:

                import org.springframework.data.annotation.Id;
                

                这篇关于Org.Hibernate.AnnotationException:没有为实体指定标识符我的表中没有 id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
              • <small id='lhnwJ'></small><noframes id='lhnwJ'>

                • <tfoot id='lhnwJ'></tfoot>

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

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