I'm working with Spring Data JPA, the implementation of JPA is hibernate.
The database I'm using is Mysql.  

The Entity will be mapped to a Mysql table and the table is created automatically when I launched the Spring application. However, when I changed the ID from Integer to String, the table is disappeared and can't be created anymore. I'm a little confused why it happens. Let me post the code comparison as below. 

The `Entity` before: 

```
import javax.persistence.Entity;
import javax.persistence.Id;

@Entity 
public class User {
  @Id
  @GeneratedValue(strategy=GenerationType.AUTO)
  private Integer id;

  private String name;

  private String email;

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getEmail() {
    return email;
  }

  public void setEmail(String email) {
    this.email = email;
  }

}

```

The `Entity` after: 

```
import javax.persistence.Entity;
import javax.persistence.Id;

@Entity 
public class User {
  @Id
  private String id;

  private String name;

  private String email;

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getEmail() {
    return email;
  }

  public void setEmail(String email) {
    this.email = email;
  }

}

```

The `CrudRepository` before:

```
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import gearon.model.entity.User;

// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
// CRUD refers Create, Read, Update, Delete

@Component
public interface UserRepository extends CrudRepository<User, Integer> {

}

```

The `CrudRepository` after:

```
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import gearon.model.entity.User;

// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
// CRUD refers Create, Read, Update, Delete

@Component
public interface UserRepository extends CrudRepository<User, String> {

}

```

Edit1
-----

The error output in console is:

```
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement

```

and it's caused by

```
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 1000 bytes

```

Edit2
-----

Found a similar question without answer but votes, it seems that more people met this issues.

[Can't use String as @Id with SpringData](https://stackoverflow.com/questions/50660942/cant-use-string-as-id-with-springdata)