解决方案 »

  1.   

    beans.xml:<?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:aop="http://www.springframework.org/schema/aop"
        xmlns:tx="http://www.springframework.org/schema/tx" 
        xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
    http://www.springframework.org/schema/aop 
    http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
        http://www.springframework.org/schema/context   
        http://www.springframework.org/schema/context/spring-context-2.5.xsd">
        <context:component-scan base-package="cn.com.zct" />
        
          <bean id="dataSource" destroy-method="close"
            class="org.apache.commons.dbcp.BasicDataSource">
            <property name="driverClassName" value="oracle.jbdc.driver.OracleDriver" />
            <property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl" />
            <property name="username" value="ssh2" />
            <property name="password" value="ssh2" />
        </bean>
     
     
        <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
           <property name="dataSource" ref="dataSource" />
             <property name="mappingResources">
              <list>
                <value>cn/com/zct/Employee.hbm.xml</value>
              </list>
             </property>
             <property name="hibernateProperties">
                <value>
                    hibernate.dialect=org.hibernate.dialect.OracleDialect
                    hibernate.hbm2ddl.auto=update
                    hibernate.show_sql=true
                    hibernate.format_sql=false
                </value>
             </property>
           </bean>
          <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
    <tx:annotation-driven transaction-manager="txManager"/>      
    </beans>
      

  2.   

    employee.hbm.xml:<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE  hibernate-mapping   
           PUBLIC  "-//Hibernate/Hibernate  Mapping  DTD//EN"   
           "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping package="cn.com.zct">  
         <class
            name="Employee" table="Employee" 
        >
            <id
                name="name"
                column="name"
                type="java.lang.String" />
            <property
                name="password"
                type="java.lang.String"
                column="password"
                not-null="true"
            />
            <property
                name="gender"
                type="java.lang.String"
                column="gender"
                not-null="true"        
           />
        </class>
    </hibernate-mapping>
           
           
      

  3.   

    你登录的用户没有create table的权限
      

  4.   

    数据库要自己创建的吧,表可以由hibernate帮你建