JPA 注解生成表问题,已解决

博客主要讲述了在使用JPA时遇到的SQL语法错误,由于在主键的@Column注解中错误地设置了unique=true,导致Druid解析SQL时抛出异常。解决方案是移除unique参数,因为主键默认就是唯一的。
摘要由CSDN通过智能技术生成

java.sql.SQLException: sql injection violation, syntax error, expect RPAREN, actual UNIQUE unique,问题已解决

报错信息

java.sql.SQLException: sql injection violation, syntax error, expect RPAREN, actual UNIQUE unique,
Caused by: com.alibaba.druid.sql.parser.ParserException: syntax error, expect RPAREN, actual UNIQUE unique

2020-03-24 19:30:09 com.alibaba.druid.filter.logging.Log4jFilter.statementLogError(Log4jFilter.java:152) ERROR: {conn-10001, stmt-20000} execute error. create table bss_sensitive_command (cmd_id varchar(32) not null unique, cmd_name varchar(50) not null, command varchar(500) not null, description varchar(100), is_regular varchar(32) not null, status varchar(1) not null, primary key (cmd_id))
java.sql.SQLException: sql injection violation, syntax error, expect RPAREN, actual UNIQUE unique, pos 70 : create table bss_sensitive_command (cmd_id varchar(32) not null unique, cmd_name varchar(50) not null, command varchar(500) not null, description varchar(100), is_regular varchar(32) not null, status varchar(1) not null, primary key (cmd_id))
at com.alibaba.druid.wall.WallFilter.check(WallFilter.java:592)
at com.alibaba.druid.wall.WallFilter.statement_executeUpdate(WallFilter.java:432)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeUpdate(FilterChainImpl.java:2373)
at com.alibaba.druid.filter.FilterAdapter.statement_executeUpdate(FilterAdapter.java:2486)
at com.alibaba.druid.filter.FilterEventAdapter.statement_executeUpdate(FilterEventAdapter.java:327)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeUpdate(FilterChainImpl.java:2373)
at com.alibaba.druid.filter.FilterAdapter.statement_executeUpdate(FilterAdapter.java:2486)
at com.alibaba.druid.filter.FilterEventAdapter.statement_executeUpdate(FilterEventAdapter.java:327)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeUpdate(FilterChainImpl.java:2373)
at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.executeUpdate(StatementProxyImpl.java:225)
at com.alibaba.druid.pool.DruidPooledStatement.executeUpdate(DruidPooledStatement.java:169)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:227)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178)
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:503)
at org.hibernate.cfg.Conf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值