用了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);