Hibernate: What am I missing? Cannot find @Id, instead of @Index

Every example I found uses @Id, but when I try to write my code, many of the annotations I'm used to have disappeared, there are annotations like @Index, and @Entity options have changed. I looked through the Hibernate documentation and can't find anything on how to change all my annotations, so I'm looking at a dummy version?

Even @Column () with the name left, it's very confusing, I use Hibernate 3, but it's hard for me to believe that they went through and broke EVERY annotation that they used to support.

I downloaded the latest version of Hibernate3.jar, that everything I turned on while looking at the JAR, I see annotation packages

import org.hibernate.annotations.Entity;
import org.hibernate.annotations.Table;
+3
source share
2 answers

I think the wrong class path on your side is more likely than the dummy version. And without additional information about the version of Hibernate that you are using, the JARs that you have on the way to the class, I don't know what to add.

Update: I suggest using JPA annotations for Hibernate annotations. Here are the dependencies that I use with the latest version of Hibernate Entity Manager:

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
+2

, .

, , , .

, hibernate-annotations ? JAR, javax.persistence ( hibernate-jpa-2.0-api-1.0.0.Final.jar)?

0

Source: https://habr.com/ru/post/1754254/


All Articles