Hibernate:错误:您的 SQL 语法有错误

戴夫0688

我在使用 JPA/Hibernate 执行语句时遇到问题。

我正在尝试插入记录。该语句将打印到控制台:

Hibernate: insert into loan (amount, auto_renew, billed, billing_date, close_date, comment, currency_id, date_offer_added, duration, earned, interest_abs, loan_ext_id, open_date, operator_fee_abs, operator_fees, platform_fee_abs, platform_fees, range, rate, source_systems_id, user_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
09:32:56.396 [default] [XNIO-2 task-6] WARN  o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 1064, SQLState: 42000 
09:32:56.398 [default] [XNIO-2 task-6] ERROR o.h.e.jdbc.spi.SqlExceptionHelper - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'range, rate, source_systems_id, user_id) values (0.43967500, 0, 0, null, '2017-0' at line 1 

我的数据库配置如下所示:

    datasource:    
     # Local MYSQL DB
     type: com.zaxxer.hikari.HikariDataSource 
     url: jdbc:mysql://localhost:3306/coinlender?useUnicode=true&characterEncoding=utf8&useSSL=false
     username: root
     password: 
jpa:
    database-platform: org.hibernate.dialect.MariaDBDialect
    database: MYSQL
    show-sql: true

我怎样才能更接近这个问题?我找不到错误的原因。

谁能帮帮我吗?

亲切的问候,大卫

延斯

rangemysql中关键字不要将其用作列名。

顺便说一句,如果您使用的是 Hibernate/JPA,您应该使用 HQL/JPQL 而不是普通的 sql

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章