hibernate generator increment confict with table auto increment -


i set generator 'increment' in hbm file, , put auto_increment thing in database table also. creteria showing issue ....

this both thing conflicting ? ?

yes conflicting, makes no sense..

when using hibernate built-in generator 'increment', it's hibernate generate identifiers counting maximum primary key value @ startup, not safe in multi jvm , using database auto_increment it's database generate unique identity new rows.

in mysql db, if using auto_increment should use identity in mapping let database safely generate unique identity.

from hibernate documentation

increment

generates identifiers of type long, short or int unique when no other process inserting data same table. not use in cluster.

identity

supports identity columns in db2, mysql, ms sql server, sybase , hypersonicsql. returned identifier of type long, short or int.

more information
hibernate doc section 5.1.4.1. generator
my sql auto_increment documentation


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -