Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@Generatedvalue and MySQL

 
Kamil Kuchta
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the column in the database defined correctly as a auto increment column?
 
Kamil Kuchta
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly. PrimaryKey, Integer, NotNull, Auto Inc, Unsigned, Zerofill
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Normally if you have a column where unique keys are auto-generated, you leave that column out of your INSERT statements.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic