使用以下方言创建表时出现以下错误
“org.hibernate.dialect.mysqlinnodbdialect”
hibernate:创建表user(id integer not null,name varchar(100),primary key(id))type=innodb
org.hibernate.tool.schema.spi.commandacceptanceexception:通过org.hibernate.tool.schema.internal.exec.generationtargettodatabase.accept(generationtargettodatabase)上的jdbc语句执行ddl时出错。java:67)位于org.hibernate.tool.schema.internal.abstractschemamigrator.applysqlstring(abstractschemamigrator)。java:559)在org.hibernate.tool.schema.internal.abstractschemamigrator.applysqlstrings(abstractschemamigrator.org.hibernate.tool.schema.internal.abstractschemamigrator.applysqlstrings)。java:504)位于org.hibernate.tool.schema.internal.abstractschemamigrator.createtable(abstractschemamigrator。java:277)在org.hibernate.tool.schema.internal.groupedschemamigratorimpl.performtablesmigration(groupedschemamigratorimpl。java:71)在org.hibernate.tool.schema.internal.abstractschemamigrator.performmigration(abstractschemamigrator。java:207)位于org.hibernate.tool.schema.internal.abstractschemamigrator.domigration(abstractschemamigrator.com)。java:114)位于org.hibernate.tool.schema.spi.schemamanagementtoolcoordinator.performdatabaseaction(schemamanagementtoolcoordinator)。java:183)在org.hibernate.tool.schema.spi.schemamanagementtoolcoordinator.process(schemamanagementtoolcoordinator。java:72)在org.hibernate.internal.sessionfactoryimpl。java:313)在org.hibernate.boot.internal.sessionfactorybuilderimpl.build(sessionfactorybuilderimpl。java:452)在org.hibernate.cfg.configuration.buildsessionfactory(配置。java:710)在org.hibernate.cfg.configuration.buildsessionfactory(配置。java:726)在com.adeptia.hibernate.hibernateutil.buildsessionfactory(hibernateutil。java:13)在com.adeptia.hibernate.hibernateutil.(冬眠)。java:8)在com.adeptia.mainclass.returnhello(mainclass。java:16)在sun.reflect.nativemethodaccessorimpl.invoke0(本机方法)在sun.reflect.nativemethodaccessorimpl.invoke(未知源)在sun.reflect.delegatingmethodaccessorimpl.invoke(未知源)在java.lang.reflect.method.invoke(未知源)在org.glassfish.jersey.server.model.internal.resourcemethodinvocationhandlerfactory$1.invoke(resourcemethodinvocationhandlerfactory)。java:81)位于org.glassfish.jersey.server.model.internal.abstractjavaresourcemethoddispatcher$1.run(abstractjavaresourcemethoddispatcher)。java:143)在org.glassfish.jersey.server.model.internal.abstractjavaresourcemethoddispatcher.invoke(abstractjavaresourcemethoddispatcher)。java:160)位于org.glassfish.jersey.server.model.internal.javaresourcemethoddispatcherprovider$typeoutinvoker.dodispatch(javaresourcemethoddispatcherprovider)。java:203)在org.glassfish.jersey.server.model.internal.abstractjavaresourcemethoddispatcher.dispatch(abstractjavaresourcemethoddispatcher)。java:97)位于org.glassfish.jersey.server.model.resourcemethodinvoker.invoke(resourcemethodinvoker)。java:389)在org.glassfish.jersey.server.model.resourcemethodinvoker.apply(resourcemethodinvoker。java:347)在org.glassfish.jersey.server.model.resourcemethodinvoker.apply(resourcemethodinvoker。java:102)在org.glassfish.jersey.server.serverruntime$2.run(serverruntime。java:303)在org.glassfish.jersey.internal.errors$1.call(errors。java:271)在org.glassfish.jersey.internal.errors$1.call(errors。java:267)在org.glassfish.jersey.internal.errors.process(错误。java:315)在org.glassfish.jersey.internal.errors.process(errors。java:297)在org.glassfish.jersey.internal.errors.process(errors。java:267)在org.glassfish.jersey.process.internal.requestscope.runinscope(requestscope。java:317)在org.glassfish.jersey.server.serverruntime.process(服务器运行时)。java:286)位于org.glassfish.jersey.server.applicationhandler.handle(applicationhandler。java:1072)在org.glassfish.jersey.servlet.webcomponent.service(webcomponent。java:399)在org.glassfish.jersey.servlet.servletcontainer.service(servletcontainer。java:381)在org.glassfish.jersey.servlet.servletcontainer.service(servletcontainer。java:344)在org.glassfish.jersey.servlet.servletcontainer.service(servletcontainer。java:221)位于org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain)。java:303)在org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain。java:208)在org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve。java:220)在org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve。java:122)在org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase。java:504)在org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve。java:170)在org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve。java:103)在org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve。java:116)在org.apache.catalina.connector.coyoteadapter.service(coyoteadapter。java:421)在org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor。java:1074)在org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol。java:611)在org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint。java:314)java.util.concurrent.threadpoolexecutor.runworker(未知源)java.util.concurrent.threadpoolexecutor$worker.run(未知源)org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread)。java:61)位于java.lang.thread.run(未知源代码)原因:java.sql.sqlsyntaxerrorexception:您的sql语法有错误;在com.mysql.cj.jdbc.exceptions.sqlerror.createsqlexception(sqlerror)的第1行的“type=innodb”附近,检查与您的mysql服务器版本对应的手册,以获得正确的语法。java:112)在com.mysql.cj.jdbc.exceptions.sqlerror.createsqlexception(sqlerror。java:89)在com.mysql.cj.jdbc.exceptions.sqlexceptionsmapping.translateexception(sqlexceptionsmapping)。java:116)在com.mysql.cj.jdbc.statementimpl.executeinternal(statementimpl。java:958)在com.mysql.cj.jdbc.statementimpl.execute(statementimpl。java:808)在org.hibernate.tool.schema.internal.exec.generationtargettodatabase.accept(generationtargettodatabase。java:54) ... 56个以上
1条答案
按热度按时间9jyewag01#
如果您使用的mysql版本高于5.0,请使用以下任一方言: