SFAH
SFAH

Reputation: 644

JPA : Error in your SQL syntax in spring entity

I am using spring framework and when I am creating the FareRate Entity it gives me following error

Unable to execute schema management to JDBC target [create table fare_rate (id bigint not null auto_increment, minimum varchar(255), moving varchar(255), starting varchar(255), primary key (id))]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'starting varchar(255), primary key (id))' at line 1

FareRate.class

@Entity
public class FareRate implements Serializable{
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String starting;

    private String moving;

    private String minimum;

    public Long getId() {
        return id;
    }

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

    public String getStarting() {
        return starting;
    }

    public void setStarting(String starting) {
        this.starting = starting;
    }

    public String getMoving() {
        return moving;
    }

    public void setMoving(String moving) {
        this.moving = moving;
    }

    public String getMinimum() {
        return minimum;
    }

    public void setMinimum(String minimum) {
        this.minimum = minimum;
    }
}

Upvotes: 0

Views: 1041

Answers (1)

juergen d
juergen d

Reputation: 204746

starting is a reserved keyword in MySQL. Choose a different name for the column.

Upvotes: 3

Related Questions