当遇到任何查询错误(SQLGrammarException、InvalidDataAccessResourceUsageException等)时,优先检查数据库文档,不要随意猜测字段名或表名。
.pdm文件或用户上传的数据库设计文档d:\Project\Java\拖轮项目AI重构目录下的数据库设计文档@Table(name = "...")注解@Column(name = "...")注解是否与文档一致Bus_Customer_CustomerType,但实际表名可能是bus_customer_customertypeCustomerID或customerid如果数据库文档中显示:
| 表名 | bus_customer_customertype |
|------|--------------------------|
| 字段 | customerid (varchar) |
| 字段 | customertype (int) |
则实体类应为:
@Entity
@Table(name = "bus_customer_customertype")
public class BusCustomerCustomerType {
@Id
@Column(name = "customerid")
private String customerId;
@Id
@Column(name = "customertype")
private Integer customerType;
}