Assigned Algorithm

Assigned Algorithm
  • This algorithm is default primary key generation algorithm in hibernate applications, it will not required configurations in mapping file.
  • This algorithm will not have its own mechanism to generate primary key value , it will request to Client Application to provide primary key value explicitly.
  • This algorithm is able to support for any type of primary key values like short, int, long, String, etc.
  • This algorithm is supported by almost all the databases like Oracle, MySQL, DB2, etc.
  • This algorithm is not required any input parameter.
  • This algorithm is represented by Hibernate in the form of a predefined class “”.


<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC 
"-//Hibernate/Hibernate Mapping DTD//EN"

	<class name="com.ashok.hibernate.sample.model.Employee" table="emp">
		<id name="id" type="int" column="id">
			<generator class="assigned" />
		<property name="empName" column="emp_name" type="string" />
		<property name="address" column="address" type="string" />
		<property name="salary" column="salary" type="double" />
Assigned Algorithm
Scroll to top