ID Generator
Previous Home Next

Id generator is used to autogenerate id of objects.Different batabase support different types of generator. most commonly used generaor that are supported by oracle are:

  1. increment
  2. sequential


Increment generator uses highest value of primary key increases to generator id value.


Consider previous example of Student,in which id generator is used as:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<!-- r4r.co.in. -->
<class name="r4r.Student">
<id name="id" type="int">
<generator class="increment"></generator>
<property name="name"></property>
<property name="course"></property>
Previous Home Next