是一样的,如果需要建表 你可以直接根据xml文件来写表啊
如:<class name="Client" table="ClientInf">  表名就是ClientInf,
<property name="clientid" type="java.lang.String">
            <column name="clientid" />
        </property>
则字段名就是clientid.

解决方案 »

  1.   

    liufei8463(武汉小兵) :大哥,你想累死我是不是啊,能自动生成,干嘛自己干呀
      

  2.   

    liufei8463:我已经导了一半表进去了,另外一半没进去,我正在查错呢。。
      

  3.   

    在Spring的配置文件里面 默认是applicationContext.xml 这样配置就可以了
    <bean  id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
         <property name="dataSource" ref="dataSource"></property>
         <property name="hibernateProperties">
             <props>
                 <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                 <prop key="hibernate.show_sql">true</prop>
                 <prop key="hibernate.hbm2ddl.auto">create</prop>
                 <prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
             </props>
         </property>
         <property name="mappingResources">
             <list>

                 <value>com/opensymphony/workflow/spi/hibernate3/HibernateCurrentStep.hbm.xml</value>
                 <value>com/opensymphony/workflow/spi/hibernate3/HibernateHistoryStep.hbm.xml</value>
                 <value>com/opensymphony/workflow/spi/hibernate3/HibernateWorkflowEntry.hbm.xml</value>              
                 <!-- value>com/opensymphony/module/propertyset/hibernate/PropertySetItemImpl.hbm.xml</value>
                 <value>com/opensymphony/workflow/spi/hibernate3/WorkflowDescriptor.hbm.xml</value-->
             </list>
         </property>
    </bean>
      

  4.   

    zhjb1025() :你来晚鸟,偶都导完拉,还是谢谢
      

  5.   

    啊,学习了!我以前以为只有ANT才行。给LZ个例子,包括了 .java-> hbm -> sqlschema:<?xml version="1.0" ?><project> <!-- 这里定义了使用到的 class path -->
    <property name="src.of.java" value="./src"/>
    <property name="dest.of.hbm" value="./src"/>
    <path id="class.path.of.Ray">
    <fileset dir="./lib">
    <include name="*.jar"/>
    </fileset>
    </path>

    <target name="doclet2"
    description="Generates Hibernate class descriptor files.">
    <!-- 注意这个 taskdef, 一定要有。-->
    <taskdef name="hibernatedoclet"
    classname="xdoclet.modules.hibernate.HibernateDocletTask">
    <classpath refid="class.path.of.Ray"/>
    </taskdef>
    <!-- 这里定义了doclet任务。-->
    <hibernatedoclet destdir="${src.of.java}">
    <fileset dir="${src.of.java}">
    <include name="test2/Test.java"/>
    </fileset>
    <!--  这里定义了生成hbm文件的版本格式。-->
    <hibernate version="3.0" xmlencoding="utf-8"/>
    </hibernatedoclet>
    </target>

    <!-- 下面是已经编写好的任务了。 注意里面,shcemaexport任务标签中,是不需要指定fileset的,否则会报错-->
    <target name="schemaexport" depends="doclet2">
    <taskdef name="schemaexport"
    classname="org.hibernate.tool.hbm2ddl.SchemaExportTask">
    <classpath refid="class.path.of.Ray"/>
    </taskdef>

    <schemaexport config="hibernate.cfg.xml" quiet="no" text="no" drop="no" delimiter=";"
    output="schema-export.sql"> </schemaexport>
    </target>

    </project>