• Hibernate报错: Unable to execute command


    错误详细描述

    org.hibernate.tool.schema.spi.CommandAcceptanceException: Unable to execute command [create table student (id integer not null auto_increment, age integer, name varchar(255), primary key (id)) type=InnoDB]
    at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:63)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:434)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:419)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:310)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:165)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:134)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:120)
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:148)
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:308)
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:476)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:707)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:723)
    at org.hibernate.pojo.StudentManager.main(StudentManager.java:12)

    当时想着创建一个student表,字段是id,name,age

    解决方法:

    在hibernate.cfg.xml中加入下边这句话

    <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>

    配置hibernate SQL方言

  • 相关阅读:
    安装LR11 时,安装Microsoft Visual c++2005 sp1运行时组件,就会提示命令行选项语法错误,键入“命令/?”可获取帮肋信息
    用jmeter监控服务器资源
    CSS获取兄弟节点
    selenium之CSS定位
    Linux find 命令详解
    git 添加文件的可执行权限
    判断三角形类型
    冒泡排序
    selenium 显示等待 隐式等待 和强制等待
    flask 基本配置和参数解释
  • 原文地址:https://www.cnblogs.com/xint/p/8289942.html
Copyright © 2020-2023  润新知