Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

How will you create a primary key using Hibernate?
The id field in hbm.xml file is used to specify the primary key in database. We can also use generator to specify the way primary key is generated to the database. 
For example
 <id name="StudentId" type="string" >
  <column name="columnId" length="30"/>
  <generator class="IdGenerator"/>
 </id>
Here Id ="StudentId" act as primary key.