We're about to go live with our website but don't want to expose our users to id's in the low digits. Seeing UserId:3 on a page just doesn't look good or even professional. So have embarked on finding out how to set a start value for entity Id's.
We're using mysql 4.1.7 with innodb tables and hibernate 3. All of our entities are mapped with the following:
Code:
<id name="id" type="long"><generator class="native"/></id>
Now as far as I can tell from the mysql and innodb manuals, and from the hibernate website and book the only way to do this is to insert a record with a given id, say 18274128 and then delete that record.
http://dev.mysql.com/doc/mysql/en/innod ... olumn.htmlI've actually tried this with our setup on a couple of tables and it only seems to work from the mysql shell and not from hibernate itself, even using straight sql on the jdbc connection, and even using explicit delete from foo where id= statements, and finally even tried creating the records and rolling back the tx.
What would be superb is:
Code:
<id name="id" startval="72382387"...
or as a parameter to a generator. Does anyone else see a need for this?
Initializing the start values on all of our tables via a script seems just plain ugly. Any fresh ideas greatly appreciated.
Dumitrius