Jun 4th, 2007, 04:17 PM
To use or not to use MySQLMaxValueIncrementer
Just finished (for the most part) ProSpring. Am creating my data access layer using Dao classes. Underlying DB is MySQL. All tables use an integer primary key. Naturally, auto-increment seems like a perfect fit. The book advises against using it since determining the assigned value requires a post SELECT last_insert_id() which could possibly have been incremented by another process.
I have successfully implemented my solution with the MySQLMaxValueIncrementer, but this requires a second table for each table that I have, essentially doubling the number of tables. Not that this is a crime, but it seems excessive. Since the book was written before Spring version 2.0, is the use of last_insert_id() still a problem, or can it be used safely now with the newer version of Spring?
Thanks in advance for any help.