| Author |
@Generatedvalue and MySQL
|
Kamil Kuchta
Greenhorn
Joined: Mar 09, 2009
Posts: 17
|
|
I can't generate id value in MySQL using @Generatedvalue.
SQLException: no value for 2 parameter in exprection INSERT INTO tab(value, id) values(?, ?)
I tried to use everything what is in commentary
Thanks for help!
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
|
Is the column in the database defined correctly as a auto increment column?
|
 |
Kamil Kuchta
Greenhorn
Joined: Mar 09, 2009
Posts: 17
|
|
|
Exactly. PrimaryKey, Integer, NotNull, Auto Inc, Unsigned, Zerofill
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
|
Normally if you have a column where unique keys are auto-generated, you leave that column out of your INSERT statements.
|
 |
 |
|
|
subject: @Generatedvalue and MySQL
|
|
|