Foreign Algorithm

Foreign Algorithm
  • This primary key generation algorithm is able to generate primary key values on the basis of the foreign key of the present table.
  • This algorithm is able to generate primary key values of the data types like short, int and long.
  • This algorithm is not required any input parameters to generate primary key values.
  • This algorithm is represented by Hibernate software in the form of a short name “foreign” and in the form of a predefined class like “org. ForeignGenerator”.


<?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=""/>
		<property name="empName" column="emp_name" type="string" />
		<property name="address" column="address" type="string" />
		<property name="salary" column="salary" type="float" />
Foreign Algorithm
Scroll to top