严重: Unsuccessful: create table ac_user (id integer not null auto_increment, name varchar(30), password varchar(16), Email varchar(255), primary key (id)) type=InnoDB
八月 08, 2012 11:54:47 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
严重: 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 'type=InnoDB' at line 1
八月 08, 2012 11:54:47 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
信息: schema update complete
无法自动建表啊。

解决方案 »

  1.   

    实体类
    package com.xiaoqi.web.Model;public class User {
    private Integer id;
    private String name;
    private String password;
    private String Email; public Integer getId() {
    return id;
    }
    public void setId(Integer id) {
    this.id = id;
    }
    public String getName() {
    return name;
    }
    public void setName(String name) {
    this.name = name;
    }
    public String getPassword() {
    return password;
    }
    public void setPassword(String password) {
    this.password = password;
    }
    public String getEmail() {
    return Email;
    }
    public void setEmail(String email) {
    Email = email;
    }

    }配置文件
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC 
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <hibernate-mapping package="com.xiaoqi.web.Model">
    <class name="User" table="ac_user">
    <id name="id" type="int" column="id">
    <generator class="native"/>
    </id>
    <property name="name" length="30"/>
    <property name="password" length="16"/>
    <property name="Email"/>
    </class>
    </hibernate-mapping>
      

  2.   

    插入的是什么数据库啊,上面都提示是SQL语句出错喽,仔细检察下哪里写错了吧
      

  3.   

    <property name="hibernate.hbm2ddl.auto">create</property>
    配置文件加上
      

  4.   

    这个是我的配置文件applicationContext.xml
    我用的是update, 后来吧update修改成了create还是不行。<?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

    <!-- JDBC链接配置 -->
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
    <property name="driverClass" value="com.mysql.jdbc.Driver"/>
    <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/zwgbk"/>
    <property name="user" value="root"/>
    <property name="password" value="123456"/>
    </bean>

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource"/>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.format_sql">true</prop>
    <prop key="hibernate.hbm2ddl.auto">update</prop>

    </props>
    </property>
    <property name="mappingResources"> 
    <value>com/xiaoqi/web/Model/User.hbm.xml</value>
    </property>
    </bean>
    <!-- 定义事务管理 -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory">
    <ref local="sessionFactory"/>
    </property>
    </bean>

     
     <tx:advice id="txAdvice" transaction-manager="transactionManager">
      <!-- 设置事物的属性 -->
      <tx:attributes>
       <tx:method name="save" propagation="REQUIRED" rollback-for="java.lang.Exception"/>
       <tx:method name="update*" propagation="REQUIRED" rollback-for="java.lang.Exception"/>
       <tx:method name="delete*" propagation="REQUIRED" rollback-for="java.lang.Exception"/>
       <tx:method name="find*" propagation="REQUIRED" read-only="true" />
      </tx:attributes>
     </tx:advice>


    <!-- 把事务管理给Dao层 -->
    <bean id="UserDaoImpl" class="com.xiaoqi.web.Dao.Impl.UserDaoImpl">
    <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <!-- Dao层接口赋予Service实现层 -->
    <bean id="UserServiceImpl" class="com.xiaoqi.web.Service.Impl.UserServiceImpl">
    <property name="userDao" ref="UserDaoImpl" /><!-- userDao为UserServiceImpl里面定义的userDao的set方法-->
    </bean>
    <!-- service层接口赋予Action -->
      <bean id="UserAction" class="com.xiaoqi.web.Action.UserAction">
    <property name="userService" ref="UserServiceImpl" /><!-- userService为UserAction里面定义的userService的set方法-->
    </bean>


    </beans>
      

  5.   

    <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop> 
    方言改成 试试 
      

  6.   

    换成了这个就可以了,谢谢
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>