我的 sql 查詢應該從表中獲取所有字段,并使用 UserMapper 模板將它們傳輸到 FTL 頁面。該模板指示要創建哪個對象以及要與對象的哪些字段匹配哪些表列??傊核凶侄味颊9ぷ鳎?seanceNumber 字段給出錯誤“未找到列 'seanceNumber'”。這很奇怪,因為列是正確的,所有數據類型都是 int。桌子:( id int auto_increment, name varchar(255) null, email varchar(255) null, seance varchar(255) null, seanceNumber int not null, seat int null, constraint client_id_uindex unique (id));超光速:<#list clientsList as client><tr> <td><a href="/client/${client.id}">${client.id}</a></td> <td>${client.name}</td> <td>${client.email}</td> <td>${client.seance}</td> <td>${client.seanceNumber}</td> <td>${client.seatNumber}</td></tr>SQL: public List<Client> getAll() { String sql = "SELECT * FROM client"; return jdbcTemplate.query(sql, new UserMapper());}用戶映射器: public Client mapRow(ResultSet rs, int rowNum) throws SQLException { Client client = new Client(); client.setId(rs.getInt("id")); client.setName(rs.getString("name")); client.setEmail(rs.getString("email")); client.setSeance(rs.getString("seance")); client.setSeanceNumber(rs.getInt("seanceNumber")); client.setSeatNumber(rs.getInt("seat")); return client;}結果:消息請求處理失??;嵌套異常是 org.springframework.jdbc.UncategorizedSQLException: StatementCallback; SQL [SELECT * FROM client] 的未分類 SQLException;SQL狀態[S0022];錯誤代碼[0];未找到列“seanceNumber”。;嵌套異常是 java.sql.SQLException:找不到列“seanceNumber”。也檢查了錯別字。我究竟做錯了什么?
SQLException: 未找到列
慕無忌1623718
2022-07-06 16:51:43