I set generator as 'increment' in hbm file, and also i put auto_increment thing in database table also. This creteria showing issue ....
This both thing is conflicting ? ?
I set generator as 'increment' in hbm file, and also i put auto_increment thing in database table also. This creteria showing issue ....
This both thing is conflicting ? ?
Yes they are conflicting, makes no sense..
When using hibernate built-in generator 'increment', it's hibernate that generate the identifiers by counting from the maximum primary key value at startup, not safe in multi JVM and using the database AUTO_INCREMENT it's the database that generate a unique identity for new rows.
In mySQL DB, if using AUTO_INCREMENT you should use identity in your mapping to let the database safely generate unique identity.
From hibernate documentation
increment
Generates identifiers of type long, short or int that are unique only when no other process is inserting data into the same table. Do not use in a cluster.
identity
supports identity columns in DB2, MySQL, MS SQL Server, Sybase and HypersonicSQL. The returned identifier is of type long, short or int.
More information
Hibernate Doc section 5.1.4.1. Generator
My sql AUTO_INCREMENT documentation