【问题标题】:when table name include a DOT , JPA throw "INSERT command denied to user for table 'XXX'"当表名包含 DOT 时,JPA 抛出“INSERT command denied to user for table 'XXX'”
【发布时间】:2022-01-02 20:59:32
【问题描述】:

我对 JPA 有一个奇怪的问题。我已将数据库中的一个表从 "Users" 重命名为 "App.Users"。并将这个注释放到我的实体类中:@Table(name="App.Users") 然后我得到了这个错误:

INSERT command denied to user 'XXXXX'@'XXXXX' for table 'Users'

我正在使用 MariaDB。

【问题讨论】:

    标签: jpa mariadb ejb


    【解决方案1】:

    请阅读 MariaDB 文档的 Identifier names 章节。

    在 [0-9,a-z,A-Z$_] 范围内的字符不是 ANSI 字符且不是 unicode 字符 >= 0x0080FF 的标​​识符必须用反引号引起来。

    不带引号的标识符中的小数点还有特殊含义:在您的示例中,它表示架构/数据库“App”和表“Users”。由于用户对数据库 App 没有权限(如果它不存在则事件)发生权限错误。

    【讨论】:

      猜你喜欢
      • 2017-07-08
      • 2011-11-08
      • 2022-10-31
      • 2018-08-29
      • 1970-01-01
      • 1970-01-01
      • 2019-03-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多