用了hibernate4以后SchemaExport的方法也改变了
原先是这样的:
new SchemaExport(new AnnotationConfiguration().
configure()).
create(false, true);
hibernate4以后取消了AnnotationConfiguration(过时),而引入了ServiceRegistry。
所以现在是这样的:
Configuration cfg = new Configuration().configure();
new SchemaExport(new ServiceRegistryBuilder().applySettings(cfg.getProperties()).buildServiceRegistry(), cfg).create(false,
true);