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 ‘desc varchar(255)’ at line 1
和平时一样我使用Hibernate自动建数据表,出现了报错。
这个报错莫名其妙,我找了很久才发现是定义参数问题,其实就是我自定义的参数和系统参数冲突。
附上代码:
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;
@Entity
public class UpdateInfo {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)//设置为自动递增
private int id;
private String version;//服务器最新版本
private String apkUrl;//最新版本路径
private String desc;//版本更新细节
private Date time;//版本发布时间
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getApkUrl() {
return apkUrl;
}
public void setApkUrl(String apkUrl) {
this.apkUrl = apkUrl;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
}
就是上面的参数desc和系统冲突,改一下名字就可以了,以上!
害没办法,坑一个接着一个!