-
Jun 4th, 2007, 04:17 PM
#1
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.
-
Jun 5th, 2007, 04:33 AM
#2
You could use one increment table and a row per increment counter with two columns - increment name and value.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules