Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker': Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of class path resource [data.sql]: insert into user(id,name,username,age,balance) values(1,"张三","zhangsan",21,100.00); nested exception is org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "张三" not found; SQL statement:
insert into user(id,name,username,age,balance) values(1,"张三","zhangsan",21,100.00) [42122-199]
2019-10-11 09:45:02.371 INFO 5232 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2019-10-11 09:45:02.383 INFO 5232 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-10-11 09:45:02.392 ERROR 5232 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker': Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of class path resource [data.sql]: insert into user(id,name,username,age,balance) values(1,"张三","zhangsan",21,100.00); nested exception is org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "张三" not found; SQL statement:
insert into user(id,name,username,age,balance) values(1,"张三","zhangsan",21,100.00) [42122-199]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:218) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1341) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1187) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.beans.factory.support.Abs
IDEA使用sprintboot使用h2本地数据库。插入数据总是报错( Column "张三" not found; SQL statement:)
最新推荐文章于 2024-07-02 17:55:52 发布
本文介绍了在使用SpringBoot结合H2数据库时遇到的插入数据报错问题,错误信息显示未找到列"张三"。通过分析报错信息,发现问题在于SQL语句中的字符串字段使用了双引号,而应使用英文状态的单引号。纠正这一细节后,问题得以解决。
摘要由CSDN通过智能技术生成