Когда я пытаюсь создать новую таблицу в своей базе данных, я получаю исключение:
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table post (id bigint not null, anons varchar(255), fulltext varchar(255), title varchar(255), views integer not null, primary key (id)) engine=InnoDB" via JDBC Statement
Это происходит из-за этого:
Caused by: java.sql.SQLSyntaxErrorException: 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 'varchar(255), title varchar(255), views integer not null, primary key (id)) engi' at line 1
Мой класс сообщений:
package com.coursework.CourseWork.Models;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Post {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String title, anons, fulltext;
private int views;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAnons() {
return anons;
}
public void setAnons(String anons) {
this.anons = anons;
}
public String getFulltext() {
return fulltext;
}
public void setFulltext(String fulltext) {
this.fulltext = fulltext;
}
public int getViews() {
return views;
}
public void setViews(int views) {
this.views = views;
}
}
И application.properties:
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/courseWork?useSSL=false&useUTF-8=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
spring.datasource.username=pavel
spring.datasource.password=T@@f4ck2002
Я смотрю, бросаю свой код около 4 часов и до сих пор не могу понять, почему у меня есть SyntaxError. Просто хотите узнать, что я здесь не так делаю?