优秀如你,代码世界因你绽放光彩!!!

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.ac_flight' doesn't exist

1....springBoot运行报错:

ycom.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'flight0_.arrival_city' in 'field list'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_201]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_201]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_201]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_201]

  Unknown column 'flight0_.arrival_city' in 'field list':

说明:springBoot工程访问,获取界面数据时,报错!!!

数据库存在不能识别的列,也就是访问的表不存在这个字段,

那么针对这个问题,去调节一下entity类

 1   @Id
 2     @GeneratedValue(strategy = GenerationType.IDENTITY) //自增设置
 3     /**
 4      * @Column 注解(表的字段)  必须加上 ,不然 test 会报错
 5      *   报错信息 : 数据库表 不存在 某个字段
 6      *   com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'flight0_.arrival_city' in 'field list'
 7      */
 8     @Column(name="flight_id")
 9     private Integer id;
10     @Column(name="flight_no")
11     private String flightNo;
12     @Column(name="departure_city")
13     private String departureCity;
14     @Column(name="departure_time")
15     private Date departureTime;
16     @Column(name="arrival_time")
17     private Date arrivalTime;
18     @Column(name="arrival_city")
19     private String arrivalCity;

 

 

posted @ 2019-08-22 18:56  Hi~Hi  阅读(3400)  评论(0编辑  收藏  举报
学习不分先后,知识不分多少;事无巨细,当以虚心求教;三人行,必有我师焉!!!wished for you successed !!!