我在使用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
我怎样才能更接近这个问题?我找不到错误的原因。
有人可以帮助我吗?
亲切的问候, 大卫
答案 0 :(得分:1)
range
是mysql中的keyword。不要将它用作列名。