@Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘right add constraint FK3ut1k6sexs4awgyxi4hfrbs9l foreign key (manage_id) referen’ at line 1
Hibernate: create table right (jurisdiction_id integer not null, jurisdictions varchar(255), manage_id bigint, primary key (jurisdiction_id)) engine=InnoDB
17:03:39.150 logback [restartedMain] WARN o.h.t.s.i.ExceptionHandlerLoggedImpl - GenerationTarget encountered exception accepting command : Error executing DDL “create table right (jurisdiction_id integer not null, jurisdictions varchar(255), manage_id bigint, primary key (jurisdiction_id)) engine=InnoDB” via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL “create table right (jurisdiction_id integer not null, jurisdictions varchar(255), manage_id bigint, primary key (jurisdiction_id)) engine=InnoDB” via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:559)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:504)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.createTable(AbstractSchemaMigrator.java:277)
at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:71)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:207)
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:114)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:183)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:310)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:57)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean 0 ( A b s t r a c t B e a n F a c t o r y . j a v a : 320 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t S i n g l e t o n B e a n R e g i s t r y . g e t S i n g l e t o n ( D e f a u l t S i n g l e t o n B e a n R e g i s t r y . j a v a : 222 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . d o G e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 318 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . g e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 199 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . g e t B e a n ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 1083 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . f i n i s h B e a n F a c t o r y I n i t i a l i z a t i o n ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 853 ) a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . r e f r e s h ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 546 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . w e b . s e r v l e t . c o n t e x t . S e r v l e t W e b S e r v e r A p p l i c a t i o n C o n t e x t . r e f r e s h ( S e r v l e t W e b S e r v e r A p p l i c a t i o n C o n t e x t . j a v a : 142 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r e f r e s h ( S p r i n g A p p l i c a t i o n . j a v a : 775 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r e f r e s h C o n t e x t ( S p r i n g A p p l i c a t i o n . j a v a : 397 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r u n ( S p r i n g A p p l i c a t i o n . j a v a : 316 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r u n ( S p r i n g A p p l i c a t i o n . j a v a : 1260 ) a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r u n ( S p r i n g A p p l i c a t i o n . j a v a : 1248 ) a t c o m . w e i x i n M a n a g e . W e i x i n M a n a g e A p p l i c a t i o n . m a i n ( W e i x i n M a n a g e A p p l i c a t i o n . j a v a : 18 ) a t s u n . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e 0 ( N a t i v e M e t h o d ) a t s u n . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e ( U n k n o w n S o u r c e ) a t s u n . r e f l e c t . D e l e g a t i n g M e t h o d A c c e s s o r I m p l . i n v o k e ( U n k n o w n S o u r c e ) a t j a v a . l a n g . r e f l e c t . M e t h o d . i n v o k e ( U n k n o w n S o u r c e ) a t o r g . s p r i n g f r a m e w o r k . b o o t . d e v t o o l s . r e s t a r t . R e s t a r t L a u n c h e r . r u n ( R e s t a r t L a u n c h e r . j a v a : 49 ) C a u s e d b y : c o m . m y s q l . j d b c . e x c e p t i o n s . j d b c 4. M y S Q L S y n t a x E r r o r E x c e p t i o n : Y o u h a v e a n e r r o r i n y o u r S Q L s y n t a x ; c h e c k t h e m a n u a l t h a t c o r r e s p o n d s t o y o u r M y S Q L s e r v e r v e r s i o n f o r t h e r i g h t s y n t a x t o u s e n e a r ′ r i g h t ( j u r i s d i c t i o n i d i n t e g e r n o t n u l l , j u r i s d i c t i o n s v a r c h a r ( 255 ) , m a n a g e i d b ′ a t l i n e 1 a t s u n . r e f l e c t . N a t i v e C o n s t r u c t o r A c c e s s o r I m p l . n e w I n s t a n c e 0 ( N a t i v e M e t h o d ) a t s u n . r e f l e c t . N a t i v e C o n s t r u c t o r A c c e s s o r I m p l . n e w I n s t a n c e ( U n k n o w n S o u r c e ) a t s u n . r e f l e c t . D e l e g a t i n g C o n s t r u c t o r A c c e s s o r I m p l . n e w I n s t a n c e ( U n k n o w n S o u r c e ) a t j a v a . l a n g . r e f l e c t . C o n s t r u c t o r . n e w I n s t a n c e ( U n k n o w n S o u r c e ) a t c o m . m y s q l . j d b c . U t i l . h a n d l e N e w I n s t a n c e ( U t i l . j a v a : 406 ) a t c o m . m y s q l . j d b c . U t i l . g e t I n s t a n c e ( U t i l . j a v a : 381 ) a t c o m . m y s q l . j d b c . S Q L E r r o r . c r e a t e S Q L E x c e p t i o n ( S Q L E r r o r . j a v a : 1030 ) a t c o m . m y s q l . j d b c . S Q L E r r o r . c r e a t e S Q L E x c e p t i o n ( S Q L E r r o r . j a v a : 956 ) a t c o m . m y s q l . j d b c . M y s q l I O . c h e c k E r r o r P a c k e t ( M y s q l I O . j a v a : 3491 ) a t c o m . m y s q l . j d b c . M y s q l I O . c h e c k E r r o r P a c k e t ( M y s q l I O . j a v a : 3423 ) a t c o m . m y s q l . j d b c . M y s q l I O . s e n d C o m m a n d ( M y s q l I O . j a v a : 1936 ) a t c o m . m y s q l . j d b c . M y s q l I O . s q l Q u e r y D i r e c t ( M y s q l I O . j a v a : 2060 ) a t c o m . m y s q l . j d b c . C o n n e c t i o n I m p l . e x e c S Q L ( C o n n e c t i o n I m p l . j a v a : 2536 ) a t c o m . m y s q l . j d b c . C o n n e c t i o n I m p l . e x e c S Q L ( C o n n e c t i o n I m p l . j a v a : 2465 ) a t c o m . m y s q l . j d b c . S t a t e m e n t I m p l . e x e c u t e ( S t a t e m e n t I m p l . j a v a : 734 ) a t c o m . z a x x e r . h i k a r i . p o o l . P r o x y S t a t e m e n t . e x e c u t e ( P r o x y S t a t e m e n t . j a v a : 95 ) a t c o m . z a x x e r . h i k a r i . p o o l . H i k a r i P r o x y S t a t e m e n t . e x e c u t e ( H i k a r i P r o x y S t a t e m e n t . j a v a ) a t o r g . h i b e r n a t e . t o o l . s c h e m a . i n t e r n a l . e x e c . G e n e r a t i o n T a r g e t T o D a t a b a s e . a c c e p t ( G e n e r a t i o n T a r g e t T o D a t a b a s e . j a v a : 54 ) . . . 39 c o m m o n f r a m e s o m i t t e d H i b e r n a t e : a l t e r t a b l e r i g h t a d d c o n s t r a i n t F K 3 u t 1 k 6 s e x s 4 a w g y x i 4 h f r b s 9 l f o r e i g n k e y ( m a n a g e i d ) r e f e r e n c e s u s e r m a n a g e ( m a n a g e i d ) 17 : 03 : 39.219 l o g b a c k [ r e s t a r t e d M a i n ] W A R N o . h . t . s . i . E x c e p t i o n H a n d l e r L o g g e d I m p l − G e n e r a t i o n T a r g e t e n c o u n t e r e d e x c e p t i o n a c c e p t i n g c o m m a n d : E r r o r e x e c u t i n g D D L " a l t e r t a b l e r i g h t a d d c o n s t r a i n t F K 3 u t 1 k 6 s e x s 4 a w g y x i 4 h f r b s 9 l f o r e i g n k e y ( m a n a g e i d ) r e f e r e n c e s u s e r m a n a g e ( m a n a g e i d ) " v i a J D B C S t a t e m e n t o r g . h i b e r n a t e . t o o l . s c h e m a . s p i . C o m m a n d A c c e p t a n c e E x c e p t i o n : E r r o r e x e c u t i n g D D L " a l t e r t a b l e r i g h t a d d c o n s t r a i n t F K 3 u t 1 k 6 s e x s 4 a w g y x i 4 h f r b s 9 l f o r e i g n k e y ( m a n a g e i d ) r e f e r e n c e s u s e r m a n a g e ( m a n a g e i d ) " v i a J D B C S t a t e m e n t a t o r g . h i b e r n a t e . t o o l . s c h e m a . i n t e r n a l . e x e c . G e n e r a t i o n T a r g e t T o D a t a b a s e . a c c e p t ( G e n e r a t i o n T a r g e t T o D a t a b a s e . j a v a : 67 ) a t o r g . h i b e r n a t e . t o o l . s c h e m a . i n t e r n a l . A b s t r a c t S c h e m a M i g r a t o r . a p p l y S q l S t r i n g ( A b s t r a c t S c h e m a M i g r a t o r . j a v a : 559 ) a t o r g . h i b e r n a t e . t o o l . s c h e m a . i n t e r n a l . A b s t r a c t S c h e m a M i g r a t o r . a p p l y S q l S t r i n g s ( A b s t r a c t S c h e m a M i g r a t o r . j a v a : 504 ) a t o r g . h i b e r n a t e . t o o l . s c h e m a . i n t e r n a l . A b s t r a c t S c h e m a M i g r a t o r . a p p l y F o r e i g n K e y s ( A b s t r a c t S c h e m a M i g r a t o r . j a v a : 433 ) a t o r g . h i b e r n a t e . t o o l . s c h e m a . i n t e r n a l . A b s t r a c t S c h e m a M i g r a t o r . p e r f o r m M i g r a t i o n ( A b s t r a c t S c h e m a M i g r a t o r . j a v a : 249 ) a t o r g . h i b e r n a t e . t o o l . s c h e m a . i n t e r n a l . A b s t r a c t S c h e m a M i g r a t o r . d o M i g r a t i o n ( A b s t r a c t S c h e m a M i g r a t o r . j a v a : 114 ) a t o r g . h i b e r n a t e . t o o l . s c h e m a . s p i . S c h e m a M a n a g e m e n t T o o l C o o r d i n a t o r . p e r f o r m D a t a b a s e A c t i o n ( S c h e m a M a n a g e m e n t T o o l C o o r d i n a t o r . j a v a : 183 ) a t o r g . h i b e r n a t e . t o o l . s c h e m a . s p i . S c h e m a M a n a g e m e n t T o o l C o o r d i n a t o r . p r o c e s s ( S c h e m a M a n a g e m e n t T o o l C o o r d i n a t o r . j a v a : 72 ) a t o r g . h i b e r n a t e . i n t e r n a l . S e s s i o n F a c t o r y I m p l . < i n i t > ( S e s s i o n F a c t o r y I m p l . j a v a : 310 ) a t o r g . h i b e r n a t e . b o o t . i n t e r n a l . S e s s i o n F a c t o r y B u i l d e r I m p l . b u i l d ( S e s s i o n F a c t o r y B u i l d e r I m p l . j a v a : 467 ) a t o r g . h i b e r n a t e . j p a . b o o t . i n t e r n a l . E n t i t y M a n a g e r F a c t o r y B u i l d e r I m p l . b u i l d ( E n t i t y M a n a g e r F a c t o r y B u i l d e r I m p l . j a v a : 939 ) a t o r g . s p r i n g f r a m e w o r k . o r m . j p a . v e n d o r . S p r i n g H i b e r n a t e J p a P e r s i s t e n c e P r o v i d e r . c r e a t e C o n t a i n e r E n t i t y M a n a g e r F a c t o r y ( S p r i n g H i b e r n a t e J p a P e r s i s t e n c e P r o v i d e r . j a v a : 57 ) a t o r g . s p r i n g f r a m e w o r k . o r m . j p a . L o c a l C o n t a i n e r E n t i t y M a n a g e r F a c t o r y B e a n . c r e a t e N a t i v e E n t i t y M a n a g e r F a c t o r y ( L o c a l C o n t a i n e r E n t i t y M a n a g e r F a c t o r y B e a n . j a v a : 365 ) a t o r g . s p r i n g f r a m e w o r k . o r m . j p a . A b s t r a c t E n t i t y M a n a g e r F a c t o r y B e a n . b u i l d N a t i v e E n t i t y M a n a g e r F a c t o r y ( A b s t r a c t E n t i t y M a n a g e r F a c t o r y B e a n . j a v a : 390 ) a t o r g . s p r i n g f r a m e w o r k . o r m . j p a . A b s t r a c t E n t i t y M a n a g e r F a c t o r y B e a n . a f t e r P r o p e r t i e s S e t ( A b s t r a c t E n t i t y M a n a g e r F a c t o r y B e a n . j a v a : 377 ) a t o r g . s p r i n g f r a m e w o r k . o r m . j p a . L o c a l C o n t a i n e r E n t i t y M a n a g e r F a c t o r y B e a n . a f t e r P r o p e r t i e s S e t ( L o c a l C o n t a i n e r E n t i t y M a n a g e r F a c t o r y B e a n . j a v a : 341 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . i n v o k e I n i t M e t h o d s ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 1804 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . i n i t i a l i z e B e a n ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 1741 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . d o C r e a t e B e a n ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 576 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . c r e a t e B e a n ( A b s t r a c t A u t o w i r e C a p a b l e B e a n F a c t o r y . j a v a : 498 ) a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . l a m b d a 0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:853) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) at com.weixinManage.WeixinManageApplication.main(WeixinManageApplication.java:18) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'right (jurisdiction_id integer not null, jurisdictions varchar(255), manage_id b' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465) at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:734) at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95) at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54) ... 39 common frames omitted Hibernate: alter table right add constraint FK3ut1k6sexs4awgyxi4hfrbs9l foreign key (manage_id) references user_manage (manage_id) 17:03:39.219 logback [restartedMain] WARN o.h.t.s.i.ExceptionHandlerLoggedImpl - GenerationTarget encountered exception accepting command : Error executing DDL "alter table right add constraint FK3ut1k6sexs4awgyxi4hfrbs9l foreign key (manage_id) references user_manage (manage_id)" via JDBC Statement org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table right add constraint FK3ut1k6sexs4awgyxi4hfrbs9l foreign key (manage_id) references user_manage (manage_id)" via JDBC Statement at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:559) at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:504) at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applyForeignKeys(AbstractSchemaMigrator.java:433) at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:249) at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:114) at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:183) at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:310) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939) at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:57) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda 0(AbstractBeanFactory.java:320)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)atorg.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:853)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)atorg.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)atorg.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)atorg.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)atorg.springframework.boot.SpringApplication.run(SpringApplication.java:316)atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1260)atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1248)atcom.weixinManage.WeixinManageApplication.main(WeixinManageApplication.java:18)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource)atsun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)atjava.lang.reflect.Method.invoke(UnknownSource)atorg.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)Causedby:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMySQLserverversionfortherightsyntaxtousenear′right(jurisdictionidintegernotnull,jurisdictionsvarchar(255),manageidb′atline1atsun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeMethod)atsun.reflect.NativeConstructorAccessorImpl.newInstance(UnknownSource)atsun.reflect.DelegatingConstructorAccessorImpl.newInstance(UnknownSource)atjava.lang.reflect.Constructor.newInstance(UnknownSource)atcom.mysql.jdbc.Util.handleNewInstance(Util.java:406)atcom.mysql.jdbc.Util.getInstance(Util.java:381)atcom.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)atcom.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)atcom.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)atcom.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)atcom.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)atcom.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)atcom.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)atcom.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)atcom.mysql.jdbc.StatementImpl.execute(StatementImpl.java:734)atcom.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95)atcom.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)atorg.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)...39commonframesomittedHibernate:altertablerightaddconstraintFK3ut1k6sexs4awgyxi4hfrbs9lforeignkey(manageid)referencesusermanage(manageid)17:03:39.219logback[restartedMain]WARNo.h.t.s.i.ExceptionHandlerLoggedImpl−GenerationTargetencounteredexceptionacceptingcommand:ErrorexecutingDDL"altertablerightaddconstraintFK3ut1k6sexs4awgyxi4hfrbs9lforeignkey(manageid)referencesusermanage(manageid)"viaJDBCStatementorg.hibernate.tool.schema.spi.CommandAcceptanceException:ErrorexecutingDDL"altertablerightaddconstraintFK3ut1k6sexs4awgyxi4hfrbs9lforeignkey(manageid)referencesusermanage(manageid)"viaJDBCStatementatorg.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)atorg.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:559)atorg.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:504)atorg.hibernate.tool.schema.internal.AbstractSchemaMigrator.applyForeignKeys(AbstractSchemaMigrator.java:433)atorg.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:249)atorg.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:114)atorg.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:183)atorg.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)atorg.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:310)atorg.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467)atorg.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939)atorg.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:57)atorg.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)atorg.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390)atorg.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377)atorg.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)atorg.springframework.beans.factory.support.AbstractBeanFactory.lambdadoGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:853)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at com.weixinManage.WeixinManageApplication.main(WeixinManageApplication.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘right add constraint FK3ut1k6sexs4awgyxi4hfrbs9l foreign key (manage_id) referen’ at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:734)
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95)
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
… 38 common frames omitted
上面的错我查询了很多种方法;没有解决问题。
先讲一下过程:
上面的错产生的原因:是我用JPA建一张多对一表
[图片][图片]过程如图,但是我运行的时候就是给我报上面的错。开始我遇见问题就是百度,然后在百度上找了很多种方法就是不能解决问题,花了我一天的时间,后来发现我的找错的方式不对。
这我就来教大家正确的找错方法,使用于新手:
对于上面的问题,是MySQLSyntaxErrorException类异常,我们对异常有一定了解的,都知道这个异常就是数据库的异常,所有我们已经定位异常是哪类异常了。这类是数据库异常,我就把hibernate打印的sql语句,放到sql可视化工具上去运行,发现有错,然后做相应的改动,包括字段,约束等,但是还是有错。这时我就考虑是不是表名有问题,我改动了表名,果然是这个问题。我找到问题,数据库不能关键字做表名。
总结,当遇上这类问题,在建表的时候出错,我们首先要去检查是否是关键字冲突,然后我们可以去百度sql有哪些异常,做对应的修改。
谢谢,希望后面的新手们能给你们带来一些启示。