qq_罪名_1
2019-01-19 00:21
这里是怎么出错了 我重新写了一遍还是不行...
把你的邮箱发我,我可以把整个项目的代码都给你。mybatis-generator.xml和application.properties文件同时位于resources的根目录下面
应该是你的mapper.xml文件有问题。mybatis-generator.xml是mybatis生成的配置文件,位于resources目录下面。
2019-01-19 17:56:31.762 INFO 8904 --- [nio-8090-exec-2] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited
2019-01-19 17:56:32.212 INFO 8904 --- [nio-8090-exec-2] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
2019-01-19 17:56:32.395 WARN 8904 --- [nio-8090-exec-2] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.jdbc.BadSqlGrammarException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
### The error may involve com.miaoshaproject.dao.UserPasswordDOMapper.insertSelective-Inline
### The error occurred while setting parameters
### SQL: insert into user_password
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
看你的mybatis-generator里面设置sqlMapGenerator了没有。
<sqlMapGenerator targetPackage="mapping" targetProject="src/main/resources"> <property name="enableSubPackages" value="true" />
然后,再看application.properties里面设置了mybatis.mapper-locations了没有。
mybatis.mapper-locations=classpath:mapping/*.xml
启动的应用程序需要加上下面两个注解。里面的包名换成你自己实际对应的包名。
@SpringBootApplication(scanBasePackages = {"cn.ancony.seckill"}) @MapperScan("cn.ancony.seckill.dao")
这个没关系~只要运行没问题就行。
SpringBoot构建电商基础秒杀项目
49064 学习 · 954 问题
相似问题