gpt4 book ai didi

java - hibernate :我错过了什么?找不到@Id,而是@Index

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:40:51 24 4
gpt4 key购买 nike

我找到的每个示例都使用@Id,但是当我尝试编写代码时,我习惯使用的许多注释都消失了,有像@Index 这样的注释,@Entity 参数也发生了变化。我查看了 Hibernate 文档,但找不到任何关于更改其所有注释的内容,我是不是在看一个伪造的版本?

即使带有名称的 @Column() 也不见了,这非常令人困惑,我正在使用 Hibernate 3,但我发现很难相信他们经历并破坏了他们过去支持的每一个注释。

我下载了最新版本的 Hibernate3.jar,这就是我包含的所有内容,查看 JAR 我看到了注释包

import org.hibernate.annotations.Entity;
import org.hibernate.annotations.Table;

最佳答案

我认为您这边错误定义的类路径比伪造的版本更有可能。如果没有关于您正在使用的 Hibernate 版本的更多详细信息,您在类路径上的 JAR,我不知道要添加什么。

更新:我建议在 Hibernate 注释上使用 JPA 注释。以下是我在最新版本的 Hibernate 实体管理器中使用的依赖项:

org.hibernate:hibernate-entitymanager:jar:3.5.3-Final:compile+- org.hibernate:hibernate-core:jar:3.5.3-Final:compile|  +- antlr:antlr:jar:2.7.6:compile|  +- commons-collections:commons-collections:jar:3.2:compile|  +- dom4j:dom4j:jar:1.6.1:compile|  |  \- xml-apis:xml-apis:jar:1.0.b2:compile|  \- javax.transaction:jta:jar:1.1:compile+- org.hibernate:hibernate-annotations:jar:3.5.3-Final:compile|  \- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile+- cglib:cglib:jar:2.2:compile|  \- asm:asm:jar:3.1:compile+- javassist:javassist:jar:3.9.0.GA:compile\- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile

关于java - hibernate :我错过了什么?找不到@Id,而是@Index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3229882/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com