我创建实体
类
@Entity
@Table(name = "MATCH")
public class Match {
...variables,getters and setters...
}
在 MySQL 中,我有名为 match
的数据库表。
我还有JpaRepository
public interface MatchRepository extends JpaRepository<Match, Long>{
}
当我尝试使用 MatchRepository.findAll()
通过 Contoller
加载数据时,错误告诉我:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'match match0_' at line 1
有人可以解释一下为什么 MySQL 不允许我使用 match
之类的数据库表名称吗?
当我使用例如名称 match1
时,就可以了!
@Entity
@Table(name = "MATCH1")
public class Match {
...variables,getters and setters...
}
为什么?!
我需要这个名称 match
因为我写的是关于足球的项目....
最佳答案
关于java - Spring JPA无法使用单词 'match'作为数据库表的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34312651/