1.

How Primary Key Is Created By Using Hibernate?

Answer»

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:
[xml]
<id name=”deptId” type=”STRING” >
<column name=”columnId” length=”30″/>
<generator/>
</id>
[/xml]

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:
[xml]
<id name=”deptId” type=”string” >
<column name=”columnId” length=”30″/>
<generator/>
</id>
[/xml]



Discussion

No Comment Found