我在使用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 我的DB配置如下所示:
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我怎样才能更接近这个问题呢?我找不到错误的原因。
有人能帮帮我吗?
你好,大卫
发布于 2017-08-11 07:43:59
range是mysql中的关键字。不要将其用作列名。
顺便说一句,如果您正在使用Hibernate/JPA,您应该使用HQL/JPQL,而不是普通的sql。
https://stackoverflow.com/questions/45629611
复制相似问题