當我運行SpringBootApplication
:不成功:ALTER TABLE註釋下降外鍵
2016-04-23 05:50:24.346 INFO 11585 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2016-04-23 05:50:24.356 INFO 11585 --- [ restartedMain] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2016-04-23 05:50:24.385 INFO 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
2016-04-23 05:50:24.405 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table comment drop foreign key FK_i2t738wo4x3tdcmbhqgomubmg
2016-04-23 05:50:24.405 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.comment' doesn't exist
2016-04-23 05:50:24.423 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table comment drop foreign key FK_t0dkmpiim1vamsp4gk8prew3n
2016-04-23 05:50:24.423 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.comment' doesn't exist
2016-04-23 05:50:24.441 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table course drop foreign key FK_cuaoq0uw55jpcfvfhbuii5utp
2016-04-23 05:50:24.441 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.course' doesn't exist
2016-04-23 05:50:24.461 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table course_material drop foreign key FK_bs5094299iyx2d9ljh6i5rc6k
2016-04-23 05:50:24.461 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.course_material' doesn't exist
2016-04-23 05:50:24.481 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table course_material drop foreign key FK_e4tmf79knpcyxjfc41452wtlv
2016-04-23 05:50:24.481 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.course_material' doesn't exist
2016-04-23 05:50:24.501 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table forum drop foreign key FK_rynifmiry638ka6e08avmxl9x
2016-04-23 05:50:24.501 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.forum' doesn't exist
2016-04-23 05:50:24.533 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table mail_box drop foreign key FK_hodc1557iup5oc121suudg5hr
2016-04-23 05:50:24.533 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.mail_box' doesn't exist
2016-04-23 05:50:24.557 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table message drop foreign key FK_2kutjtgfjvk2m3i29668l0n3j
2016-04-23 05:50:24.557 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.message' doesn't exist
2016-04-23 05:50:24.577 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table message drop foreign key FK_lbhyy4gtgh0ojf80bc4aq6x45
2016-04-23 05:50:24.577 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.message' doesn't exist
2016-04-23 05:50:24.599 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table message_mailbox drop foreign key FK_eqau3hwhobsvhxr4b0m2xvuop
2016-04-23 05:50:24.599 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.message_mailbox' doesn't exist
2016-04-23 05:50:24.624 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table message_mailbox drop foreign key FK_d6vn0iflgf9k6jrbsqmwrdxjf
2016-04-23 05:50:24.624 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.message_mailbox' doesn't exist
2016-04-23 05:50:24.641 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table registered_user drop foreign key FK_jxpn3w33nyd74ygfsv0smd2i7
2016-04-23 05:50:24.641 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.registered_user' doesn't exist
2016-04-23 05:50:24.663 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_rating drop foreign key FK_3lpqe9rmerccjerpnxnhyiyhv
2016-04-23 05:50:24.663 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.user_rating' doesn't exist
2016-04-23 05:50:24.685 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_takes_course drop foreign key FK_7ra4qdylay0p2622re8tobacb
2016-04-23 05:50:24.685 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.user_takes_course' doesn't exist
2016-04-23 05:50:24.708 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_takes_course drop foreign key FK_md8p234kyrbc3unoaaqytxpre
2016-04-23 05:50:24.708 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.user_takes_course' doesn't exist
2016-04-23 05:50:26.899 INFO 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
2016-04-23 05:50:26.952 INFO 11585 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot[email protected]5ffb21e1: startup date [Sat Apr 23 05:50:21 CEST 2016]; root of context hierarchy
2016-04-23 05:50:26.956 INFO 11585 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/home],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView com.mycompany.app.controllers.HomeController.home(org.springframework.ui.Model)
2016-04-23 05:50:26.956 INFO 11585 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/welcome]}" onto public com.mycompany.app.controllers.Welcome com.mycompany.app.controllers.WelcomeController.welcome(java.lang.String)
2016-04-23 05:50:26.957 INFO 11585 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-04-23 05:50:26.957 INFO 11585 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2016-04-23 05:50:26.962 INFO 11585 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-04-23 05:50:26.962 INFO 11585 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-04-23 05:50:26.968 INFO 11585 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-04-23 05:50:27.033 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/health || /health.json],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal)
2016-04-23 05:50:27.033 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-04-23 05:50:27.033 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-04-23 05:50:27.033 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env || /env.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/info || /info.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-04-23 05:50:27.052 WARN 11585 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : Unable to start LiveReload server
2016-04-23 05:50:27.076 INFO 11585 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-04-23 05:50:27.078 INFO 11585 --- [ restartedMain] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2016-04-23 05:50:27.100 INFO 11585 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2016-04-23 05:50:27.101 INFO 11585 --- [ restartedMain] com.mycompany.app.App : Storing a few customers...
2016-04-23 05:50:27.431 INFO 11585 --- [ restartedMain] com.mycompany.app.App : Started App in 5.693 seconds (JVM running for 773.917)
2016-04-23 05:50:34.376 INFO 11585 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2016-04-23 05:50:34.376 INFO 11585 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2016-04-23 05:50:34.398 INFO 11585 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 22 ms
我已經看到了還有另外一個類似的問題,但我不知道如何解決它無論如何。很奇怪,因爲在某些情況下,同樣的錯誤似乎出現兩次,例如
2016-04-23 05:50:24.405 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table comment drop foreign key FK_i2t738wo4x3tdcmbhqgomubmg
2016-04-23 05:50:24.405 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.comment' doesn't exist
2016-04-23 05:50:24.423 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table comment drop foreign key FK_t0dkmpiim1vamsp4gk8prew3n
2016-04-23 05:50:24.423 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.comment' doesn't exist
注意,顯然這是不影響例如在一定URL請求的答覆......
編輯
我忘了提。我擁有刪除和創建此數據庫中的表的所有權限。我使用Spring來重新創建表,這是我的application.properties
文件:
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://path_to_server/Group2SEA2016
spring.datasource.username=my_user
spring.datasource.password=my_password
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=create-drop
有了這個,我想從@Entity
類重建之前每次刪除表...
對不起,我忘了提及(這裏很晚,我很累)。我可以完全訪問數據庫,即我可以刪除任何我想要的表。我將用更多的相關細節來編輯我的問題。 – nbro