简体   繁体   English

Spring Boot Autoimport import.sql 文件 - 出现“未找到列”错误

[英]Spring Boot Autoimport import.sql file - Getting a "Column Not found" Error

So I have a table in postgresql and I want to fill it with some values on application start.所以我在 postgresql 中有一个表,我想在应用程序启动时用一些值填充它。 Here is the Entity (in Kotlin):这是实体(在 Kotlin 中):

@Entity
class CalculationType(

        @Id @GeneratedValue(strategy = GenerationType.AUTO)
        var id: Long = 0,
        var guid: String = "",
        var title: String = "",
        var modified: Date,
        var creation: Date
)

my import.sql file is located under ..\\.\\resources .我的import.sql文件位于..\\.\\resources it looks like this:它看起来像这样:

insert into calculation_type (guid, title, modified, creation) VALUES ("test", "title", "2013-12-12", "2013-12-12");

I am getting an error in German, traslated it says Column »test« does not exist.我在德语中遇到错误,翻译它说Column »test« does not exist.

Thats quite strange because test is in my values, not in my column definitions.这很奇怪,因为test在我的值中,而不是在我的列定义中。

Does anyone know whats going on?有谁知道这是怎么回事?

字符常量需要单引号

insert into calculation_type (guid, title, modified, creation) VALUES ('test", 'title', '2013-12-12', '2013-12-12');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring Boot-Hibernate import.sql列名转换为大写 - Spring Boot - Hibernate import.sql column names are converted to upper case sql语法中的Hibernate import.sql错误:不成功:INSERT INTO - Hibernate import.sql error in sql syntax: Unsuccessful: INSERT INTO 在Spring Boot中如何修复“ java.sql.SQLException:找不到列'id'。”错误 - How to fix “java.sql.SQLException: Column 'id' not found.” error in Spring Boot 根据条件选择多个Hibernate import.sql - Choosing multiple Hibernate import.sql based on conditions 如何在Hibernate的import.sql中将表达式分解为更多行? - How to break expression into more lines in Hibernate's import.sql? 如何使用 spring boot 在我的 MYSQL 数据库中导入 .sql 文件? - How can I import .sql file in my MYSQL DB using spring boot? 在Spring Boot中上传文件以在sql db中添加 - File upload in Spring boot to add in sql db Spring Boot-休眠-从SQL查询导入日期 - Spring Boot - Hibernate - Import Date from SQL Query SQL Server SELECT Query使用“ CASE…END”来选择列,但发现列未找到错误 - SQL Server SELECT Query using “CASE… END” to select column but getting Column not found error PostgreSQL SQL导入失败,错误,因为找不到架构 - PostgreSQL SQL import fails with error as schema not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM