zoukankan      html  css  js  c++  java
  • 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方言

  • 相关阅读:
    爬虫技术浅析 | WooYun知识库
    爬虫技术实战 | WooYun知识库
    爬虫技术实战 | WooYun知识库
    Day 16: Goose Extractor —— 好用的文章提取工具
    mysql中间件研究(Atlas,cobar,TDDL)
    cygwin with openssh
    win2008 ent r2 开启端口
    MobaSSH SSH server for Windows
    自动化运维工具Ansible详细部署
    中科院NLPIR中文分词java版
  • 原文地址:https://www.cnblogs.com/xint/p/8289942.html
Copyright © 2011-2022 走看看