import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
public class ExportDB {
public static void main(String[] args) {
Configuration configuration=new Configuration().configure();
SchemaExport schemaExport=new SchemaExport(configuration);
schemaExport.create(true, true);
}
}
总结:用此方法用成数据表,对数据库迁移时相当方便!
本文介绍了一个简单的Java程序,该程序使用Hibernate框架实现数据库模式的创建与迁移。通过Configuration和SchemaExport类,可以便捷地管理和更新数据库结构。
2158

被折叠的 条评论
为什么被折叠?



