Learn about Hibernate Annotations and its importance in development of applications.
Hibernate Annotations
In this section we will learn about Hibernate Annotations and understand how
Hibernate Annotations is simplifying the programming.
The default method of providing the metadata to the Hibernate is the xml
file. In the xml file (hibernate.cfg.xml) the database connection information
and other configuration information is provided. There is another file Hibernate
mapping file (*.hbm.xml) which is used to map the entity with the database
table. Sometimes its very tedious method and take a lot of effort to modify the
existing file if there is some change in database. Now hibernate provides
another way to provide the mapping metadata to the application. It is known as
Hibernate annotations and it based on the Java 5 annotations. So, to use
Hibernate Annotations you should have Java 5 and Hibernate 3 or above.
Bothe Hibernate Annotations and JPA Annotations are versioned and released
from the Hibernate Core 3.5.
Here are the benefits of using Hibernate annotations:
- Easy programming
- Easy maintenance of the application
- Now the mapping information are saved into same Entity class
(java file) making the modification very easy.
- It is fully compliant with JPA.
Here are the list of Hibernate Annotations classes:
- org.hibernate.annotations.AccessType
- org.hibernate.annotations.Any
- org.hibernate.annotations.AnyMetaDef
- org.hibernate.annotations.AnyMetaDefs
- org.hibernate.annotations.BatchSize
- org.hibernate.annotations.Cache
- org.hibernate.annotations.CacheConcurrencyStrategy
- org.hibernate.annotations.CacheModeType
- org.hibernate.annotations.Cascade
- org.hibernate.annotations.CascadeType
- org.hibernate.annotations.Check
- org.hibernate.annotations.CollectionId
- org.hibernate.annotations.CollectionOfElements
- org.hibernate.annotations.Columns
- org.hibernate.annotations.DiscriminatorFormula
- org.hibernate.annotations.Entity
- org.hibernate.annotations.Fetch
- org.hibernate.annotations.FetchMode
- org.hibernate.annotations.Filter
- org.hibernate.annotations.FilterDef
- org.hibernate.annotations.FilterDefs
- org.hibernate.annotations.FilterJoinTable
- org.hibernate.annotations.FilterJoinTables
- org.hibernate.annotations.Filters
- org.hibernate.annotations.FlushModeType
- org.hibernate.annotations.ForceDiscriminator
- org.hibernate.annotations.ForeignKey
- org.hibernate.annotations.Formula
- org.hibernate.annotations.Generated
- org.hibernate.annotations.GenerationTime
- org.hibernate.annotations.GenericGenerator
- org.hibernate.annotations.GenericGenerators
- org.hibernate.annotations.Immutable
- org.hibernate.annotations.Index
- org.hibernate.annotations.IndexColumn
- org.hibernate.annotations.LazyCollection
- org.hibernate.annotations.LazyCollectionOption
- org.hibernate.annotations.LazyToOne
- org.hibernate.annotations.LazyToOneOption
- org.hibernate.annotations.Loader
- org.hibernate.annotations.ManyToAny
- org.hibernate.annotations.MapKey
- org.hibernate.annotations.MapKeyManyToMany
- org.hibernate.annotations.MetaValue
- org.hibernate.annotations.NamedNativeQueries
- org.hibernate.annotations.NamedNativeQuery
- org.hibernate.annotations.NamedQueries
- org.hibernate.annotations.NamedQuery
- org.hibernate.annotations.NaturalId
- org.hibernate.annotations.NotFound
- org.hibernate.annotations.NotFoundAction
- org.hibernate.annotations.OnDelete
- org.hibernate.annotations.OnDeleteAction
- org.hibernate.annotations.OptimisticLock
- org.hibernate.annotations.OptimisticLockType
- org.hibernate.annotations.OrderBy
- org.hibernate.annotations.ParamDef
- org.hibernate.annotations.Parameter
- org.hibernate.annotations.Parent
- org.hibernate.annotations.Persister
- org.hibernate.annotations.PolymorphismType
- org.hibernate.annotations.Proxy
- org.hibernate.annotations.ResultCheckStyle
- org.hibernate.annotations.Sort
- org.hibernate.annotations.SortType
- org.hibernate.annotations.SQLDelete
- org.hibernate.annotations.SQLDeleteAll
- org.hibernate.annotations.SQLInsert
- org.hibernate.annotations.SQLUpdate
- org.hibernate.annotations.Table
- org.hibernate.annotations.Tables
- org.hibernate.annotations.Target
- org.hibernate.annotations.Tuplizer
- org.hibernate.annotations.Tuplizers
- org.hibernate.annotations.Type
- org.hibernate.annotations.TypeDef
- org.hibernate.annotations.TypeDefs
- org.hibernate.annotations.Where
- org.hibernate.annotations.WhereJoinTable
We have given very good tutorial on Hibernate annotations, you can learn the
basics and advance concepts of using Hibernate tutorial.
Read more at
Hibernate Annotations Tutorial section.
Related Tags for Hibernate Annotations: