貌似不能,可以直接从数据库管理工具中导出语句 ,不知楼主用的什么数据库。不过这种语句是比较“官方” 效果和我们自己写的一样,但是看起来却不不好看,大写的并且和我们建表习惯不一样
建表语句
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
Configuration cfg=new Configuration().configure("/applicationContext.xml");
SchemaExport export=new SchemaExport(cfg);
export.create(true,true);
}
}
文件applicationContext.xml中涵有bean与表之间的映射的XXX.hbm.xml。
希望能给你帮助
起作用的是
<bean id="mysessionfactory" class="com.networkbench.base.database.dao.hibernate3.unclocalsessionfactorybean">
<property name="datasource"><ref local="mydatasource"/></property>
<property name="hibernateproperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.mysql5dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
</props>
</property>
</bean>