Database primary key is specified in the configuration file hbm.xml. Generator can also be used to specify how primary key is being created in the database.
In the below example, deptId acts as primary key:
<id name="deptId" type="string" >
<column name="columnId" length="30"/>
<generator/>
</id>