Important / Basic Annotations of Hibernate

Annotation Name Description
@Entity
		@Entity
		public class UserDetails {
It should be used on the top of class declaration.
It means that this is entity class and by the class name, table will be generated in database
@Id
		@Id
		private int userId;
It should be used on the top of class member which is going to be your primary key in the database.
@column
		@Column(name="uname")
		private String userName;
It should be used on the top of class member whose column name in the database you want to change by specigying as above.

you may choose-
name (optional): the column name (default to the property name)
unique (optional): set a unique constraint on this column or not (default false)
nullable (optional): set the column as nullable default false).
insertable (optional): whether or not the column will be part of the insert statement (default true)
updatable (optional): whether or not the column will be part of the update statement (default true)
columnDefinition (optional): override the sql DDL fragment for this particular column (non portable)
table (optional): define the targeted table (default primary table)
length (optional): column length (default 255)
precision (optional): column decimal precision (default 0)
scale (optional): column decimal scale if useful (default 0)
@Table
		@Table(name = "EMPLOYEE")
		public class Employee {
It should be used on the top of class name to specify table name that should be saved in database explicitly.
@Basic
		@Basic
		private String userName;
Not having an annotation for your property is equivalent to the appropriate @Basic annotation
@Transient
		@Transient
		private String userName;
The class member above which this annnotation is used will be ignored by the entity manager and will not be saved as column in the database.
@Temporal
		@Temporal(TemporalType.DATE)
		private Date date;
It should be used on the top of class member of datatype date.
You can specify which part of date you want to store into the database. (may date, time or both date and time, but date in above case)
@Lob
		@Lob
		private Character[] charData;
@Lob saves the data in BLOB or CLOB.
If class member is of type Character, it will store it as Clob or class member is of type Byte it will store in Blob
@GeneratedValue
		@Id 
		@GeneratedValue(strategy=GenerationType.SEQUENCE)
		private int userId;
This type of annotation is used in combination with @Id.
There are four values for the strategy element on the @GeneratedValue annotation: IDENTITY, AUTO, TABLE and SEQUENCE.
@Embedded
		@Entity
		public class Person {
		@Embedded Address address;
Here address is instance of class Address.
Now, address will be embedd itself into the object of class Person (in which it is declared by @Embedded).