R4R Team working to provide free of cost for experienced and freshers

Tutorials | Examples|Interview Questions and Answers|Java Tutorials| C Tutorials | C++ Tutorials | Spring Tutorials| Hibernate Tutorials | JSP Tutorials | Servelets Tutorials| C# Tutorials | PHP Tutorials etc , Basics | Download Software | Data Types | Variables | Constant | Storage & Classes | Operators | Decisions Making | Loops | Functions| Numbers | Arrays | Pointers | String | Datastructure | Expressions | Preprocessor Statement | I/O | Exception Handling | OOPs Tutorial | Classes and object |C++ Inheritance Overloading | Polymorphism | Abstraction | Encapsulation | Interfaces | Multithreading etc


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