Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot Spring引导和Spring数据org.hibernate.exception.sqlgrammareexception:无法提取结果集_Spring Boot_Spring Data - Fatal编程技术网

Spring boot Spring引导和Spring数据org.hibernate.exception.sqlgrammareexception:无法提取结果集

Spring boot Spring引导和Spring数据org.hibernate.exception.sqlgrammareexception:无法提取结果集,spring-boot,spring-data,Spring Boot,Spring Data,我已经使用Spring数据设置了一个新的Spring启动应用程序。我试图对数据库执行一个非常简单的查询,但是错误日志报告查询有问题,我不知道为什么 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 'lines line0_' at line 1 数据库表的设置如下: 线 BIG

我已经使用Spring数据设置了一个新的Spring启动应用程序。我试图对数据库执行一个非常简单的查询,但是错误日志报告查询有问题,我不知道为什么

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 'lines line0_' at line 1
数据库表的设置如下:

线 BIGINT | id VARCHAR | name 文本|存储_路径 TINYINT(1)|有效

线条实体如下所示

@Entity
@Table(name="lines")
public class Line {

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

    @Column(name="name")
    private String name;

    @Column(name="storage_path")
    private String storagePath;

    @Column(name="active", columnDefinition = "TINYINT(1)")
    private Boolean active;
    }
@Repository
public interface LineRepository extends CrudRepository<Line, Long> {

    /**
     * Return a list of lines by their active value
     * @param active the active value
     * @return List of lines
     */
    public List<Line> getByActive(Boolean active);

}
当我使用Spring数据时,我的存储库如下所示

@Entity
@Table(name="lines")
public class Line {

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

    @Column(name="name")
    private String name;

    @Column(name="storage_path")
    private String storagePath;

    @Column(name="active", columnDefinition = "TINYINT(1)")
    private Boolean active;
    }
@Repository
public interface LineRepository extends CrudRepository<Line, Long> {

    /**
     * Return a list of lines by their active value
     * @param active the active value
     * @return List of lines
     */
    public List<Line> getByActive(Boolean active);

}

事实证明,“lines”在MySQL中是一个保留字,因此为什么查询无效


我已更改了表名,解决了问题。

除了这一行之外,您还有其他异常或错误吗?