'Incorrect column specifier for column 'id'
I'm having some trouble creating tables using Hibernate with the following exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Incorrect column specifier for column 'id'
Unable to execute schema management to JDBC target [create table services (id varchar(255) not null auto_increment, adult_cost double precision not null, child_cost double precision not null, partner_id varchar(255) not null, primary key (id)) ENGINE=InnoDB]
My code for the ID column is as follows:
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
From what I understand, this exception normally occurs when you try to assign an auto_increment to a non-numeric but as you can see - I've defined id as an int.
Any help appreciated.
Solution 1:[1]
When you select primary key or any key select and give apply/go then check whether its auto incremented with not null specification then its defenitly works
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shiv kumar K |
