您的位置:首页 > 博客中心 > 数据库 >

hibernate创建导出数据库DDL schema

时间:2022-03-10 17:07

public class HibernateUtils { public static final Logger log=LoggerFactory.getLogger(HibernateUtils.class); private static SessionFactory sf; static{ try{ Configuration cfg=new Configuration().configure(); sf=cfg.buildSessionFactory(); SchemaExport se=new SchemaExport(cfg).setOutputFile("xby.sql"); se.execute(true,true,false,false); }catch(Throwable e){ log.error("SessionFacotry init error-{}",e); throw new ExceptionInInitializerError(e); } } public static SessionFactory getSessionFactory(){ return sf; } public static void shutDown(){ if(sf!=null){ sf.close(); } } }

 

hibernate创建导出数据库DDL schema,布布扣,bubuko.com

热门排行

今日推荐

热门手游