Tag:Hibernate

Hibernate Many-to-many Relationships - Many to many example in Hibernate. In this example we have used xml metadata.
Now we will learn many-to-many relationships. Let's try many-to-many example. The many-to-many ta...

A one-to-one association is similar to many-to-one association with a difference that the column will be set as unique. For example an address object can be associated with a single employee object....
Let us devel...

What are the uses of @Entity and @Id tag?
@Entity annotation indicates that the class should persist to the database.
@Id annotation represents a unique primary key
How do you tell Hibernate which classes are to ...

How to give a custom name of a table?
@Table(name="myTableName")
How to give a custom name of a column?
@Column(name="myColumnName")
How to prevent an attribute in a class from being saved into database table?
@T...

How to add a UNIQUE field?
@GeneratedValue
//It generates a unique value
How to add a UNIQUE primary key field and make it auto-complete?
@GeneratedValue(strategy=GenerationType.AUTO)
//It generates a uni...