"org.springframework.jdbc.BadSqlGrammarException: \n### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'createdAt' in 'field list'\n### The error may exist in com/chinamobile/deepwatch/identity/core/standard/mysql/mapper/TenantMapper.java (best guess)\n### The error may involve defaultParameterMap\n### The error occurred while setting parameters\n### SQL: SELECT id,code,name,description,organization_code,createdAt,updateAt,responsible_name FROM tenant_tbl\n### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'createdAt' in 'field list'\n; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'createdAt' in 'field list'\n"\nThis error occurs because your tenant_tbl table lacks a column named "createdAt". Here's how to fix it:\n\n1. Verify the Column: Use your MySQL command-line interface or a tool like phpMyAdmin to examine the structure of your tenant_tbl table and confirm whether the createdAt column exists.\n\n2. Add the Column (if missing): Use the ALTER TABLE statement to add the column. For example:\n\n\nalter table tenant_tbl add column createdAt datetime;\n\n\nThis adds a createdAt column of type DATETIME. Adjust the data type (e.g., TIMESTAMP) as needed.\n\n3. Re-run your application: Your query should now execute without the "Unknown column 'createdAt' in 'field list'".\n\n\n

Spring JDBC BadSqlGrammarException: Unknown Column 'createdAt' in 'field list' - MySQL Error Solution

原文地址: https://www.cveoy.top/t/topic/pG6U 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录