public @interface r4r
{
// code.....
}
8. We need to always remember that when we work with annotation then we must use the java version 1.5 or heigher and hibernate version must be 3.3.
9. In the level of J2SE SUN provided very limited set of annotaions like @override and @Deprecated...
10. But SUN has provided the annotations related to J2SE level under java.lang.annotaions.* package.
11. Most of the annotations related to J2EE level those are given by SUN and their implementations are given by vendors.
12. In the Hibernate SUN has provided the support of annotation under the javax.persistence package and hibernate has provided implementations for the annotations given in that packages.
13. As we use the basic annotation type in the hibernate that is given below:
@Entity
@Table
@Id
@Column
14. @Entity, @Table are class level annotations and @Id, @Column are the field level annotaions, so never be confused.
15. In the Hibernate if we use the POJO class then hibernate mapping files is not required, it means we can annotations are reducing the use of xml files in the Hibernate.
When we work with the hibernate then we alwyas remember some points those are given below:
1. We must ensure that java version must be 1.5 or higher.
2. we must use hibernate version 3.3 or higher.
3. Attatched the requried jar file in the application when we want to use the annotaion.
Following jar files are given below:
1. antlr-2.7.6.jar
2. commons-collections-3.1.jar
3. dom4j-1.6.1.jar
4. hibernate-commons-annotations-3.2.0.Final.jar
5. hibernate-core-3.6.7.Final.jar
6. hibernate-jpa-2.0-api-1.0.1.Final.jar
7. javassist.jar
8. jms-1.1.jar
9. jsr250-api-1.0.jar
10.jta-1.1.jar
11.log4j-1.2.16.jar
12.ojdbc14.jar
13.slf4j-api-1.6.1.jar
14.slf4j-log4j12-1.6.1.jar
Total 14 jar files we need to set in the class path to work with these annotations with hibernate framework,
And click here to download the jar file: