Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@Generatedvalue and MySQL

 
Kamil Kuchta
Greenhorn
Posts: 17
  • 0
  • 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
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly. PrimaryKey, Integer, NotNull, Auto Inc, Unsigned, Zerofill
 
Paul Clapham
Sheriff
Pie
Posts: 20187
26
MySQL Database
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic