Seq-hilo Algorithm

Seq-hilo Algorithm
  • Seq-hilo algorithm is able to generate primary key values on the basis of the sequence value provided by the underlying database and the mapping file provided max_lo property value.
  • This algorithm is almost all same as hilo algorithm but in “seqhilo” algorithm we will get sequence value in place of the high value from Global resource.
  • This algorithm is able to generate primary key values of the data types like short, int and long.
  • This algorithm is represented by Hibernate software in the form a short name like “seqhilo” and a predefined class name like “org.”.
  • This algorithm is supported by almost all the databases which are supporting sequences internally.
  • This algorithm is required the following two input parameters.
    1. sequence: It will take sequence name provided by Database.
    2. max_lo : It will provide low value.
      Note: If we have not provided “sequence” input parameter then hibernate software will search for the default sequence name like “hibernate_sequence”.


<?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="seqhilo">
			    <param name="sequence">my_sequence</param>
			    <param name="max_lo">10</param>
		<property name="empName" column="emp_name" type="string" />
		<property name="address" column="address" type="string" />
		<property name="salary" column="salary" type="float" />
Seq-hilo Algorithm
Scroll to top