December 6, 2008 at 1:01 AM
The <generator> element
This is the optional element under <id> element. The <generator> element is used to specify the class name to be used to generate the primary key for new record while saving a new record. The <param> element is used to pass the parameter (s) to the class. Here is the example of generator element from our first application:
In this case <generator> element do not generate the primary key and it is required to set the primary key value before calling save() method.
For more information on Hibernate visit to :http://www.roseindia.net/hibernate/index.shtmlhttp://www.roseindia.net/hibernate/hibernateidgeneratorelement.shtml
December 7, 2008 at 12:39 PM
Fine i was busy in this weekend, but i spare time for you..
Mr.Sandeep. we do have many generator algorithms for our id,
So you are incrementing id value in database(leave about what the database u r using). We are using hibernate. In the assigned algorithm we should give the value that we give to the databade.
But for your solution it is better to use <generator id="increment"/>
if you use this it executes the query like selecting the max(id) value from the database and then it increments the value and it inserts the your assumed value.(incremented value)