2 Replies Latest reply on Jul 6, 2006 5:03 PM by Urs Wagner

    primary auto increment for MySQL

    Urs Wagner Novice

      Hello

      How will be generated an autoincrement primary key in MySQL?


      public class User {

      ...
      @Id
      @NotNull
      @GeneratedValue
      public Long getUserid() {

      return userid;
      }

      public void setUserid() {

      this.userid = userid;
      }
      }


      the generated MySQL table is


      REATE TABLE `ramschladen`.`user` (
      `userid` bigint(20) NOT NULL,
      `username` varchar(15) NOT NULL,
      `name` varchar(100) NOT NULL,
      `password` varchar(15) NOT NULL,
      PRIMARY KEY (`username`)
      )


      userid has no auto_increment specification in MySQL. What shall I do?