错误的原因在于:表中并没有字段名为student_number的字段,有如下的输出,确实看到了有student_number这个字段,
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
alter table student drop foreign key FK8FFE823BE1101F46
drop table if exists student
drop table if exists team
create table student (id varchar(255) not null, name varchar(255), student_number varchar(255), age integer, team_id varchar(255), primary key (id))
create table team (id varchar(255) not null, name varchar(255), primary key (id))
alter table student add index FK8FFE823BE1101F46 (team_id), add constraint FK8FFE823BE1101F46 foreign key (team_id) references team (id)
但是这只是假象,到数据库里查看表的结构的话,会发现表的结构并不是以上面的输出一样。
原因在于:由于数据库中的多表之间存在了外键约束,没有成功删除student和team表,意味着student和team还保持着原有的表的结构,所以导致了这个错误。